Hi all,
In my table, I have 6 columns (A-F). In column A I have blank cells or numbers. I need to sort this table by column B, then by C, and then by column D, but only the rows where column A has a number (more than 0) and place these rows at the top. The table Range is A4:F27.
Here is the code for the sorting part (from a macro recording):
[vba] Range("A4:F27").Select
ActiveWorkbook.Worksheets("Today").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Today").Sort.SortFields.Add Key:=Range("B4:B27") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Today").Sort.SortFields.Add Key:=Range("C4:C27") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Today").Sort.SortFields.Add Key:=Range("D427") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Today").Sort
.SetRange Range("A4:F27")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With[/vba]