Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Hiding / Unhiding Sheets

I have created macros to hide and unhide sheets when clicking on a button

example -
Sheets("Premium Labor Utilization").Visible = Not Sheets("Premium Labor
Utilization").Visible

I am also assigning goups of sheets to a summary button

example
Application.ScreenUpdating = False
Sheets("Premium Labor Utilization").Visible = Not Sheets("Premium Labor
Utilization").Visible
Sheets("FMLA Compliance").Visible = Not Sheets("FMLA Compliance").Visible
Sheets("FLSA Compliance").Visible = Not Sheets("FLSA Compliance").Visible
Sheets("Compliance Rpt").Visible = Not Sheets("Compliance Rpt").Visible
Sheets("Tangible Savings Summary").Visible = Not Sheets("Tangible
Savings Summary").Visible
Sheets("Selection Sheet").Select

The problem is that if I have already opened a sheet with an idividual
button - it will close if I click on a summary button and it is one of the
sheets that are part of the summary macro.

Is there any way to add some sort of error checking around this so that if a
sheet is already open it will not be closed ?

--
Thanks

Larry
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Hiding / Unhiding Sheets

Since I presume your summary button(s) will know what sheets are involved in
the summary, you could be more pro-active in determining what sheets to
display and which to hide, as
Sheets("InSummary1").Visible=True
Sheets("InSummary2").Visible=True
Sheets("InSummary3").Visible=True
Sheets("NotInSummary1").Visible = False
Sheets("NotInSummary2").Visible = False

or you can actually test each, as with:
If Not Sheets("InSummary1").Visible Then
Sheets("InSummary1").Visible=True
End If
and
If Sheets("NotInSummary2").Visible Then
Sheets("NotInSummary2").Visible = False
End If

"Larry Fitch" wrote:

I have created macros to hide and unhide sheets when clicking on a button

example -
Sheets("Premium Labor Utilization").Visible = Not Sheets("Premium Labor
Utilization").Visible

I am also assigning goups of sheets to a summary button

example
Application.ScreenUpdating = False
Sheets("Premium Labor Utilization").Visible = Not Sheets("Premium Labor
Utilization").Visible
Sheets("FMLA Compliance").Visible = Not Sheets("FMLA Compliance").Visible
Sheets("FLSA Compliance").Visible = Not Sheets("FLSA Compliance").Visible
Sheets("Compliance Rpt").Visible = Not Sheets("Compliance Rpt").Visible
Sheets("Tangible Savings Summary").Visible = Not Sheets("Tangible
Savings Summary").Visible
Sheets("Selection Sheet").Select

The problem is that if I have already opened a sheet with an idividual
button - it will close if I click on a summary button and it is one of the
sheets that are part of the summary macro.

Is there any way to add some sort of error checking around this so that if a
sheet is already open it will not be closed ?

--
Thanks

Larry

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
need code for hiding/unhiding sheets using checkboxes pzx8hf Excel Worksheet Functions 1 August 13th 08 12:11 AM
unhiding and hiding rows Paul_of_Abingdon[_2_] Excel Discussion (Misc queries) 2 March 6th 08 03:22 PM
Hiding & Unhiding graphs... Ray Charts and Charting in Excel 1 February 21st 07 08:37 PM
Hiding and unhiding sheets D.Hay Excel Discussion (Misc queries) 2 December 10th 05 03:59 PM
Hiding/Unhiding Bobby Excel Worksheet Functions 2 May 25th 05 10:40 PM


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