Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hide worksheets on Workbook_Open


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide/Show some worksheets Tony S.[_2_] Excel Discussion (Misc queries) 8 January 18th 09 07:28 PM
How to hide worksheets Man Utd New Users to Excel 3 October 20th 05 03:25 PM
Workbook_Open Problem ... Worksheets not loaded yet!? Joe HM Excel Programming 7 March 16th 05 03:29 PM
hide TASKBAR in Sub Workbook_open() Dago Excel Programming 4 April 28th 04 02:32 PM
Hide/Unhide worksheets help Jeremy Gollehon[_2_] Excel Programming 2 July 31st 03 10:05 PM


All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"