View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default Issue on Close Q

add the top line

On Error Resume Next
Dim sh As Worksheet
For Each sh In Worksheets

If sh.Name = "splash" Then
sh.Visible = True
Else
sh.Visible = xlVeryHidden
End If
Next

"Sean" wrote:

I have the following code that, on close, it hides all the Sheets
except Splash. Problem is I'm getting a debug on -
ws.Visible = xlVeryHidden

It says - Unable to set the visible property of the worksheet class

I've all sheets protected and running 2003



Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sh As Worksheet
For Each ws In Worksheets
If ws.Name = "Splash" Then
ws.Visible = True
Else
ws.Visible = xlVeryHidden
End If
Next

End Sub