Thread: Sorting of data
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Sorting of data

To use - right click sheet tabview code copy/paste this

Here is a doubleclick event I use to sort by the active column if double
click row 4.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Row = 4 Then
Range("a5:g" & Range("a65536").End(xlUp).Row) _
..Sort Key1:=Cells(5, ActiveCell.Column), Order1:=xlAscending,
Orientation:=xlTopToBottom
Cells(5, Target.Column).Select
End If
'end sub

'below plays the song if double click below row 4
mc = Cells(ActiveCell.Row, "e")
If Target.Row 4 Then
x = Right(Application.OperatingSystem, 4)
If x < 5 Then
cmd = "Start " & Chr(34) & mc & Chr(34)
Shell cmd 'works with xl97
Else
Dim FullFileName As String
'FullFileName = Selection.Offset(0, mc)
FullFileName = mc
ActiveWorkbook.FollowHyperlink Address:=FullFileName
End If
End If
End Sub

--
Don Guillett
SalesAid Software

"Arne Harder Bang" wrote in message
...
I have a spreadsheet containing musicdata. I want to make a sort,

depending on a validated column. Some times it's the artist (a=artist) and
some times it's the titel ex:

Various artist; Barrelhouse piano should be sorted after titel

Davis, Miles; Working with Miles Davis Quientet should be sorted after

artist.

Validation (A or T) is column B
Artist is column C
Titel is column D