A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
Maybe a slightly simpler sort routine. This assumes the sheet to sort is the active one. I've used resize(,4) like your code because I assume it's the rows that are unknown and not the columns. If you don't know the columns we can fix that.
Sub Sortem()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "a").End(xlUp).Row
Range("A1:A" & LastRow).Resize(, 4).Sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub