LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Hide/Unhide Sheet using VB

I have a command button to where I would like to specify which sheet I would
like to unhide. Example the sheet I would like to unhide is called Extra
Earned Income Method 2.

Thanks

"Mike H" wrote:

Hi,

Try this code. Ut hides all sheets except sheet1 on closing and unhides then
if macros are enabled. Sheet 1 should contain a suitable message to explain
that macros must be run to view sheets.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Sheet1" Then
ws.Visible = xlVeryHidden
End If
Next ws
End Sub

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = True
Next ws
End Sub

Mike

"Phendrena" wrote:

Hi,

I'm a complete novice with VB, however is it possible to use VB to unhide a
worksheet or worksheets if the script is run when the workbook is opened?
Thus if the script/macro isn't run then nothing is visable.

Thanks,

 
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 unhide rows -Protected sheet Wanna Learn Excel Discussion (Misc queries) 3 August 5th 09 05:43 PM
Hide/Unhide after protect sheet RKS Excel Discussion (Misc queries) 0 March 21st 08 05:03 AM
How to hide/unhide a sheet? Arup C[_2_] Excel Discussion (Misc queries) 1 October 23rd 07 12:16 PM
How to hide/unhide sheet Tabs in Excel 2007? Smibes Excel Worksheet Functions 10 March 28th 07 02:45 AM
Sheet / Hide & Unhide for editing only thom hoyle Excel Programming 3 June 22nd 05 07:55 PM


All times are GMT +1. The time now is 08:24 AM.

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"