View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Hide worksheets on Workbook_Open

Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Sheet1" And sh.Name < "Sheet2" Then
sh.Visible = xlSheetHidden
End If
Next sh
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"jhahes" wrote in
message ...

Could someone please help me with the following.

I want all worksheets to be hidden except for Sheet1 and Sheet2. when
the Workbook opens. I don't know if this matters but some of the
sheets are named through VBE - like SheetMain, instead of Sheet30.

Thanks for any help


--
jhahes
------------------------------------------------------------------------
jhahes's Profile:

http://www.excelforum.com/member.php...o&userid=23596
View this thread: http://www.excelforum.com/showthread...hreadid=392349