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

Hello -

I need to hide sheets when my app first begins (all except one). What is
the best way to do this? I don't want to hide each one individually.

Also, I'm assuming I would put the code in ThisWorkbook.

Any help is appreciated!
--
Sandy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Hide worksheets at startup

Sandy,

Put the following code in the ThisWorkbook code module:

Private Sub Workbook_Open()
Dim WS As Worksheet
For Each WS In Worksheets
If WS.Name < "The One You Don't Want To Hide" Then
WS.Visible = xlSheetHidden
End If
Next WS
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Sandy" wrote in message
...
Hello -

I need to hide sheets when my app first begins (all except
one). What is
the best way to do this? I don't want to hide each one
individually.

Also, I'm assuming I would put the code in ThisWorkbook.

Any help is appreciated!
--
Sandy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Hide worksheets at startup

Sandy,

If you are hiding to prevent people seeing your data, maybe you should
save the workbook with all but one sheet hidden, and then unhide the
other sheets when the workbook is opened. This way, if a user disables
macros they will only see the one sheet.

You can use Chips code and change one line:

WS.Visible = true

Thats all, Good Luck!

Peter Noneley
Cardiff
Wales
UK

Chip Pearson wrote:
Sandy,

Put the following code in the ThisWorkbook code module:

Private Sub Workbook_Open()
Dim WS As Worksheet
For Each WS In Worksheets
If WS.Name < "The One You Don't Want To Hide" Then
WS.Visible = xlSheetHidden
End If
Next WS
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Sandy" wrote in message
...
Hello -

I need to hide sheets when my app first begins (all except
one). What is
the best way to do this? I don't want to hide each one
individually.

Also, I'm assuming I would put the code in ThisWorkbook.

Any help is appreciated!
--
Sandy


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Hide worksheets at startup

Hi Peter

Good to see you in the newsgroup
I hope you are OK

If you have a update of your "Excel Function Dictionary" or if
your site is working again let me know and I change the link.

http://www.rondebruin.nl/id.htm
Bottom of the page

Good night


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Peter Noneley" wrote in message oups.com...
Sandy,

If you are hiding to prevent people seeing your data, maybe you should
save the workbook with all but one sheet hidden, and then unhide the
other sheets when the workbook is opened. This way, if a user disables
macros they will only see the one sheet.

You can use Chips code and change one line:

WS.Visible = true

Thats all, Good Luck!

Peter Noneley
Cardiff
Wales
UK

Chip Pearson wrote:
Sandy,

Put the following code in the ThisWorkbook code module:

Private Sub Workbook_Open()
Dim WS As Worksheet
For Each WS In Worksheets
If WS.Name < "The One You Don't Want To Hide" Then
WS.Visible = xlSheetHidden
End If
Next WS
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Sandy" wrote in message
...
Hello -

I need to hide sheets when my app first begins (all except
one). What is
the best way to do this? I don't want to hide each one
individually.

Also, I'm assuming I would put the code in ThisWorkbook.

Any help is appreciated!
--
Sandy




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Hide worksheets at startup

HI Ron,

Yes, I've been away for a while, but hoping to get back into the swing
of things!

Peter.

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
How do I update all worksheets at startup? kit493 Excel Worksheet Functions 2 May 28th 09 01:07 AM
Hide/Show some worksheets Tony S.[_2_] Excel Discussion (Misc queries) 8 January 18th 09 07:28 PM
Excel startup and named worksheets Owltrax Excel Discussion (Misc queries) 2 November 14th 05 05:15 PM
How to hide worksheets Man Utd New Users to Excel 3 October 20th 05 03:25 PM
Hide and unhide worksheets Profairy[_6_] Excel Programming 3 June 9th 04 04:20 PM


All times are GMT +1. The time now is 11:51 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"