I am using the following code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Static iCol As Integer, iSrt As Integer Dim w As Long Dim x As Range If Target.Column > 18 Or Target.Row > 4 Then Exit Sub End If Cancel = True w = Cells(Rows.Count, 2).End(xlUp).Row Set x = Rows("5:" & w) If (Target.Column = iCol) And (iSrt = xlAscending) Then iSrt = xlDescending Else iSrt = xlAscending iCol = Target.Column End If x.Sort Key1:=Selection, Order1:=iSrt, Header:=xlNo, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal End Sub
This works great for me apart from one small problem. My data is formatted as:
Row 5 – Font 18, Row 6 – Font 17,………. Row 10 – Font 13, Row 11 and all rows thereafter Font 12. To accomodate the larger font in rows 5:10, the row height will be proportionately larger.
Regardless of how the data is sorted, I want the formatting and the row heights to stay as is. Any thoughts on how I can achieve this?