Perhaps like so, this will scan through all the sheets in your book an only run the sorting commands on sheets that have names that start with "Net"
Sub Sort()
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name Like "Net*" Then
ws.Activate
Range("G18:CP27").Copy
Range("G32").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("H32:H41"), SortOn:=xlSortOnValues, _
Order:=xlDescending, DataOption:=xlSortNormal
ActiveSheet.Sort.SortFields.Add Key:=Range("I32:I41"), SortOn:=xlSortOnValues, _
Order:=xlDescending, DataOption:=xlSortNormal
ActiveSheet.Sort.SortFields.Add Key:=Range("G32:G41"), SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortNormal
With ActiveSheet.Sort
.SetRange Range("G32:CP41")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End If
Next ws
End Sub
I imagine the three sorting commands might be able to be consolidated into one sort command, too, but I'd need to see some real data. The sheet downloads with all #REF errors so far.
Bookmarks