Hi, I recorded the macro to sort a range starting at A3 to column D, down to last row. I want to sort ascending in column C and then D. I changed the key:=Range("C3:C100" _ in line 6 & 8 to key:=Range("C3" _, and it seemed to work. However, I dont know what to do with the this on line 11: .SetRange Range("A3:D100") to not limit at 100. Thanks
VBA Code:
Sub SORT_TOT_FAB()
Application.ScreenUpdating = False
Range("A3:D3").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("TOT FAB").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("TOT FAB").Sort.SortFields.Add2 key:=Range("C3:C100" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("TOT FAB").Sort.SortFields.Add2 key:=Range("D3:D100" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("TOT FAB").Sort
.SetRange Range("A3:D100")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("E3").Select
Application.ScreenUpdating = True
End Sub