View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] brentfid@hotmail.com is offline
external usenet poster
 
Posts: 7
Default Run-time error '1004' on hiding worksheets

I have this code in

Private Sub Workbook_Open()
ActiveWorkbook.Sheets("Cost&Marg_01").Activate
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
If sh.Name < "Cost&Marg_01" Then
sh.Visible = False
Else
sh.Visible = True
End If
Next
End Sub

I get an applicaton defined or object defined error when it gets to the
sh.Visible=False line.

What have I improperly defined here?

Brent