Cycling Through Worksheets

Cycling through worksheets

[sourcecode language=”vb” light=”true” wraplines=”false” gutter=”false”]
Sub DoOnAllWorksheets()
For i = 1 To Worksheets.count
Worksheets(i).Activate
" add code to do on each worksheet here "
i = i + 1
Next i
End Sub
[/sourcecode]

Cycling through worksheets – Excluding specific tabs

[sourcecode language=”vb” light=”true” wraplines=”false” gutter=”false”]

For i = 1 To Worksheets.Count
if sheets(i).name <> "WStoSkip" and sheets(i).name <> "OtherWStoSkip <> … then
Sheets(i).Activate

‘enter code to run on each worksheet not listedas an exclusion
End If
Next i
[/sourcecode]