Activate each sheet in workbook with exception of...

J

Jazz

I am trying to activate each Sheet in the workbook one time, with the
exception of 3 Sheets? Call them Sheet2, Wk3, and DD4. Do you know how to
do that?

Sub NextSheet()

If ActiveSheet.Index = Sheets.Count Then
Sheets(1).Activate
Else
Sheets(ActiveSheet.Index + 1).Activate
End If

End Sub
 
M

Mike H

Hi,

Try this

Sub NextSheet()
For x = 1 To Worksheets.Count
S = "Sheet2,Wk3,DD4"
V = Split(S, ",")
If Not IsError(Application.Match((Sheets(x).Name), V, 0)) Then
Sheets(x).Activate
'presumably do things
End If
Next

End Sub
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top