A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro "on off" switch



 
 
Thread Tools Display Modes
  #1  
Old November 17th, 2009, 03:51 PM posted to microsoft.public.excel.misc
Larry Fitch
external usenet poster
 
Posts: 10
Default Macro "on off" switch


I have a very simple macro assigned to a button that unhides a sheet

Sub HR_Training()
'
' HR_Training Macro
' Unhide only the HR Training Hard Dollar Cost Savings Sheet
'

'
Application.ScreenUpdating = False
Sheets("HR - Training").Visible = True
Sheets("Selection Sheet").Select
End Sub
--

What I would like to do is add a "toggle" type of functionality so that the
first press of the button will unhide the sheet, and the next time it will
hide it..

any help would be most appreciated..
Thanks

Larry
  #2  
Old November 17th, 2009, 04:01 PM posted to microsoft.public.excel.misc
Jim Thomlinson
external usenet poster
 
Posts: 2,641
Default Macro "on off" switch

Try this...

Sub HR_Training()
'
' HR_Training Macro
' Unhide only the HR Training Hard Dollar Cost Savings Sheet
'

Sheets("HR - Training").Visible = not Sheets("HR - Training").Visible
End Sub

--
HTH...

Jim Thomlinson


"Larry Fitch" wrote:


I have a very simple macro assigned to a button that unhides a sheet

Sub HR_Training()
'
' HR_Training Macro
' Unhide only the HR Training Hard Dollar Cost Savings Sheet
'

'
Application.ScreenUpdating = False
Sheets("HR - Training").Visible = True
Sheets("Selection Sheet").Select
End Sub
--

What I would like to do is add a "toggle" type of functionality so that the
first press of the button will unhide the sheet, and the next time it will
hide it..

any help would be most appreciated..
Thanks

Larry

  #3  
Old November 17th, 2009, 04:02 PM posted to microsoft.public.excel.misc
Sheeloo
external usenet poster
 
Posts: 797
Default Macro "on off" switch

Use
Sheets("HR - Training").Visible = Not Sheets("HR - Training").Visible

in place of
Sheets("HR - Training").Visible = True

"Larry Fitch" wrote:


I have a very simple macro assigned to a button that unhides a sheet

Sub HR_Training()
'
' HR_Training Macro
' Unhide only the HR Training Hard Dollar Cost Savings Sheet
'

'
Application.ScreenUpdating = False
Sheets("HR - Training").Visible = True
Sheets("Selection Sheet").Select
End Sub
--

What I would like to do is add a "toggle" type of functionality so that the
first press of the button will unhide the sheet, and the next time it will
hide it..

any help would be most appreciated..
Thanks

Larry

  #4  
Old November 17th, 2009, 07:04 PM posted to microsoft.public.excel.misc
Larry Fitch
external usenet poster
 
Posts: 10
Default Macro "on off" switch

Thanky you to the both of you..

works like a champ !!
--
Thanks

Larry


"Sheeloo" wrote:

Use
Sheets("HR - Training").Visible = Not Sheets("HR - Training").Visible

in place of
Sheets("HR - Training").Visible = True

"Larry Fitch" wrote:


I have a very simple macro assigned to a button that unhides a sheet

Sub HR_Training()
'
' HR_Training Macro
' Unhide only the HR Training Hard Dollar Cost Savings Sheet
'

'
Application.ScreenUpdating = False
Sheets("HR - Training").Visible = True
Sheets("Selection Sheet").Select
End Sub
--

What I would like to do is add a "toggle" type of functionality so that the
first press of the button will unhide the sheet, and the next time it will
hide it..

any help would be most appreciated..
Thanks

Larry

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.