Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Mon, 10 Aug 2009 07:46:34 -0500, Dave Peterson
wrote: Sometimes, If/then statements can get unruly with lots of criteria. Agreed; I considered ptting a Select Case in my own response but decided to keep it to as close to the original code as possible. Select Case is still preferred though. Private Sub CommandButton2_Click() dim i as long For i = 1 To Worksheets.Count select case lcase(worksheets(i).codename) case is = "sheet1","sheet5","sheet9" 'all lower case! 'do nothing case else sheets(i).visible = xlsheethidden end select next i Sheet1.Select End Sub EricBB wrote: why the below is not working? pls. help... Private Sub CommandButton2_Click() For i = 1 To Worksheets.Count If Not (Worksheets(i).CodeName = "Sheet1" Or "Sheet5" Or "Sheet9") Then Sheets(i).Visible = False Next Sheet1.Select End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hide Sheets | Excel Discussion (Misc queries) | |||
Can you hide Sheets? | Excel Discussion (Misc queries) | |||
Macro-Hide & Unhide Sheets with condition | Excel Discussion (Misc queries) | |||
If I have my sheets protected will that prevent me running a macro to hide certain sells? | Excel Worksheet Functions | |||
macro to hide sheets | Excel Discussion (Misc queries) |