
Originally Posted by
xld
This will handle the sort for you
[vba]
rivate Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Static SortOrder(1 To 14) As Long
Dim ColNo As Long
If Not Intersect(Target, Me.Range("A7:N7")) Is Nothing Then
With Me.ListObjects("Table1")
ColNo = ActiveCell.Column
If SortOrder(ColNo) = xlAscending Then
SortOrder(ColNo) = xlDescending
Else
SortOrder(ColNo) = xlAscending
End If
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=Range("Table1[" & .ListColumns(ColNo) & "]"), _
SortOn:=xlSortOnValues, _
Order:=SortOrder(ColNo), _
DataOption:=xlSortNormal
With .Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
Target.Offset(1, 0).Select
End If
End Sub[/vba]