The code below is working on the active sheet and I want to get it to work on Worksheet("patrol") I know that I must change Range to .Range but this is giving me an error which states.
Application-defined or object-defined error.
Thanks in advance for your time.
Gerry
Code: Select all
With Worksheets("Patrol")
Dim f As Long
For f = 2 To 20 Step 3
Range(Cells(1, f), Cells(33, f + 2)).Sort _
Key1:=Cells(1, f + 1), Key2:=Cells(1, f + 2), _
Header:=xlYes
Next f
End With