View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim[_35_] Tim[_35_] is offline
external usenet poster
 
Posts: 1
Default Error with code... ".Visible"

When I run the code below I get the following error:
Run-time error '1004'
Method 'Visible' of object '_Worksheet' failed

This only displays when I have the debug set to break on all errors.

This code is supposed to hide 8 worksheets and leave number 9 visible...the error occurs with Sheet_7
For Each wSheet In ThisWorkbook.Worksheets
If wSheet.CodeName = "Sheet_9" Then
wSheet.Visible = xlSheetVisible
Else
wSheet.Visible = xlSheetVeryHidden
End If
Next wSheet
....any ideas on what's up?

Tim