Reputation: 549
New to the community, so please excuse any mistakes.
Using VBA I'm trying to loop through some sheets in excel (actions will be added later). However when SH=2 it hits a 40036 error on the second line which i can not explain. Maybe someone else can? (BTW, the workbook has 5 sheets at the moment)
For Sh = 1 To ActiveWorkbook.Worksheets.Count
If ActiveWorkbook.Worksheets(Sh).Name <> "Overview" Then
MsgBox ActiveWorkbook.Worksheets(Sh).Name
End If
Next
Upvotes: 0
Views: 132
Reputation: 2607
Easier way to do the same process (won"t give you the error which I'm guessing is the result of an indexing error)
Dim Sh As Worksheet
For Each Sh In ActiveWorkbook.Worksheets
If Sh.Name <> "Overview" Then
MsgBox(Sh.Name)
End If
Next Sh
Upvotes: 1