I am trying to get VBA/Macro to mutisort a file. I was able to record a macro and get it done on the sample sheet, but it would be limited to the defined rows. I tried coding it like below, but I am now getting a named argument error.
Columns("A:A").Select
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Add2 Key:=Range("G1").Select
Range(Selection, Selection.End(xlDown)).Select , SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Add2 Key:=Range("E1").Select
Range(Selection, Selection.End(xlDown)).Select , SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Add2 Key:=Range("I1").Select
Range(Selection, Selection.End(xlDown)).Select , SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("RAW DATA").Sort
.SetRange Range("A:BG").Select
Range(Selection, Selection.End(xlDown)).Select
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
I need to sort by 1. column G Descending, then 2, Column E Descending, and 3 Column I Descending.
The Columns will always be A through BG.
Can anyone help?
Columns("A:A").Select
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Add2 Key:=Range("G1").Select
Range(Selection, Selection.End(xlDown)).Select , SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Add2 Key:=Range("E1").Select
Range(Selection, Selection.End(xlDown)).Select , SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("RAW DATA").Sort.SortFields. _
Add2 Key:=Range("I1").Select
Range(Selection, Selection.End(xlDown)).Select , SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("RAW DATA").Sort
.SetRange Range("A:BG").Select
Range(Selection, Selection.End(xlDown)).Select
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
I need to sort by 1. column G Descending, then 2, Column E Descending, and 3 Column I Descending.
The Columns will always be A through BG.
Can anyone help?