Hi Everyone,
First off, a huge thanks to everyone helping out here - I love this community and have learned so much from reading other threads.
I'm trying to do a very simple for loop that cycles through sheets and executes a long code within that sheet. However, for some reason, the for loop is not working and the code only executes on the first sheet. My code is below:
Any ideas?
First off, a huge thanks to everyone helping out here - I love this community and have learned so much from reading other threads.
I'm trying to do a very simple for loop that cycles through sheets and executes a long code within that sheet. However, for some reason, the for loop is not working and the code only executes on the first sheet. My code is below:
Code:
Sub RowDel()
x = Worksheets.Count
For J = x To 2 Step -1
Application.DisplayAlerts = False
With Sheets(J) 'example code to execute
Rows("1:1").Delete Shift:=xlUp
Rows("3:3").Delete Shift:=xlUp
End With
Next J
Application.DisplayAlerts = True
End Sub
Any ideas?
Last edited by a moderator: