I would like to loop thru the work book and hide all sheets except a given list. Below are two macros I wrote, neither works. Can anyone tweak one or the other?
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub Macro1()
For Each sh In ActiveWorkbook.Worksheets
Select Case sh.Name
Case Is = "Summary", "Sheet1", "Assa Abloy Entr", "Cornell Storefr", "Dh PAce Company", "Stanley Access", "Thyssenkrupp El", "Won door Corp"
Case Else
MsgBox sh.Name
ActiveWindow.SelectedSheets.Visible = False
End Select
Next sh
End Sub
Sub macro2()
For Each ws In Sheets:
If ws = "Summary" Then ws.Visible = True
If ws = "Sheet1" Then ws.Visible = True
If ws = "Assa Abloy Entr" Then ws.Visible = True
If ws = "Cornell Storefr" Then ws.Visible = True
If ws = "Dh Pace Company" Then ws.Visible = True
If ws = "Stanley Access" Then ws.Visible = True
If ws = "Thysssenkrupp El" Then ws.Visible = True
If ws = "won door" Then ws.Visible = True
ws.Visible = False
Next
End Sub
[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub Macro1()
For Each sh In ActiveWorkbook.Worksheets
Select Case sh.Name
Case Is = "Summary", "Sheet1", "Assa Abloy Entr", "Cornell Storefr", "Dh PAce Company", "Stanley Access", "Thyssenkrupp El", "Won door Corp"
Case Else
MsgBox sh.Name
ActiveWindow.SelectedSheets.Visible = False
End Select
Next sh
End Sub
Sub macro2()
For Each ws In Sheets:
If ws = "Summary" Then ws.Visible = True
If ws = "Sheet1" Then ws.Visible = True
If ws = "Assa Abloy Entr" Then ws.Visible = True
If ws = "Cornell Storefr" Then ws.Visible = True
If ws = "Dh Pace Company" Then ws.Visible = True
If ws = "Stanley Access" Then ws.Visible = True
If ws = "Thysssenkrupp El" Then ws.Visible = True
If ws = "won door" Then ws.Visible = True
ws.Visible = False
Next
End Sub
[/FONT]