Question : Error - Method Visible of Object Worksheet Failed

In the code snippet below I am trying to hide all sheets except for the one called "jane_sheet".  The problem is that the workbook is defaulted to open with all sheets hidden except for the Welcome Page which is defined like this:
Const WelcomePage = "Welcome".
I think that I'm getting the error because it's trying to hide the Welcome Page first and then unhide "jane_sheet" and it can't do that because hiding the Welcome Page first wouldn't leave any sheets visible.  Any ideas on how I can change this?  Thanks!
1:
2:
3:
4:
5:
6:
Case LCase("jane")
For Each ws In ThisWorkbook.Worksheets
If LCase(ws.Name) = LCase("jane_sheet") Then ws.Visible = xlSheetVisible
Else ws.Visible = xlSheetVeryHidden
End If
Next

Answer : Error - Method Visible of Object Worksheet Failed

Case LCase("jane")
Sheets("jane_sheet").Visible = xlSheetVisible
For Each ws In ThisWorkbook.Worksheets
If LCase(ws.Name) <> LCase("jane_sheet") Then
ws.Visible = xlSheetVeryHidden
End If
Next
Random Solutions  
 
programming4us programming4us