0

I have the macro below recorded for sheet 3, I would like it to run on sheet three through to sheet 369, could anyone enlighten me.
Thanks in advance.
Sub sort()
'
' sort Macro
'
' Keyboard Shortcut: Ctrl+a
'
ActiveWorkbook.Worksheets("Sheet3").sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet3").sort.SortFields.Add Key:=Range("G1:G92") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet3").sort
.SetRange Range("A1:I92")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by bmlkidd
0

Try this:

For i = 1 To ActiveWorkbook.Sheets.Count
'
ActiveWorkbook.Sheets(i).Activate
Range("A1:A192").sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G1:G92").sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Next
End Sub

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.