A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
To: Peruanos72
re: full speed ahead
Where have you been for the last 3 weeks? I've had 3 root canals and lost 2 lbs during that time.
The following sort code finds the last row with data in Column R (column 18) and uses that for the bottom right corner of the entire sort range. Column Q (column 17) is the column sorted.
If data extends below that in column R then the code will need adjusting.
'---
Sub NewSort()
Dim LastRow As Long
Dim rngToSort As Excel.Range
With ActiveSheet
LastRow = .Cells(.Rows.Count, 18).End(xlUp).Row '18 is column R
Set rngToSort = .Range("A1", .Cells(LastRow, 18))
rngToSort.Sort Key1:=.Cells(1, 17), Order1:=xlDescending, _
Header:=xlYes, MatchCase:=False '17 is column Q
End With
End Sub
'---
Note: blank cells sort to the bottom (always)
Don't sort data containing formulas
Excel programs at MediaFire...