I need help!
I need a macro that lets me sort column I in Ascending order and then Column N in Ascending order.
I tried record a macro, and that works fine, however, I have multiple spreadsheets with varied rows (different row counts) that it only sorts until row 233 on the other sheets that have more rows... help?
here's my macro:
Sub Macro3()
'
' Macro3 Macro
'
'
ActiveWorkbook.Worksheets("Pending").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Pending").Sort.SortFields.Add Key:=Range("I2:I233" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Pending").Sort.SortFields.Add Key:=Range("N2:N233" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Pending").Sort
.SetRange Range("A1:O233")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
I need a macro that lets me sort column I in Ascending order and then Column N in Ascending order.
I tried record a macro, and that works fine, however, I have multiple spreadsheets with varied rows (different row counts) that it only sorts until row 233 on the other sheets that have more rows... help?
here's my macro:
Sub Macro3()
'
' Macro3 Macro
'
'
ActiveWorkbook.Worksheets("Pending").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Pending").Sort.SortFields.Add Key:=Range("I2:I233" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Pending").Sort.SortFields.Add Key:=Range("N2:N233" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Pending").Sort
.SetRange Range("A1:O233")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub