Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default Command button unhides but not hides

Hello I have command button . what I want to do is; hide or unhide the
sheet.
If I select the button it should unhide the sheet, but if I select the
button again to hide the sheet
Below is my code
the first 2 rows by themselves unhide the sheet but
When I added the last 2 rows the code it does not work.
Thanks in advance

Private Sub CommandButton1_Click()

Sheets("2008 Complete").Visible = True
Sheets("2008 Complete").Select
Sheets("2008 Complete").Visible = False
Sheets("Summary-Sheet").Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Command button unhides but not hides

You can do it with just this one line of code. This will toggle the
visibility back and forth with subsequent clicks...

Sheets("2008 Complete").Visible = Not Sheets("2008 Complete").Visible
--
HTH...

Jim Thomlinson


"Wanna Learn" wrote:

Hello I have command button . what I want to do is; hide or unhide the
sheet.
If I select the button it should unhide the sheet, but if I select the
button again to hide the sheet
Below is my code
the first 2 rows by themselves unhide the sheet but
When I added the last 2 rows the code it does not work.
Thanks in advance

Private Sub CommandButton1_Click()

Sheets("2008 Complete").Visible = True
Sheets("2008 Complete").Select
Sheets("2008 Complete").Visible = False
Sheets("Summary-Sheet").Select
End Sub

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
COMMAND BUTTON BOB New Users to Excel 1 April 11th 08 06:59 PM
Using a command button to add Chance Excel Discussion (Misc queries) 5 October 21st 05 08:08 PM
Button hides unhides columns, how? JimH Excel Discussion (Misc queries) 3 April 20th 05 09:59 PM
Command Button Mark New Users to Excel 2 March 23rd 05 10:33 AM
Command Button Chris Hale Excel Discussion (Misc queries) 1 February 10th 05 05:14 AM


All times are GMT +1. The time now is 10:54 AM.

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

About Us

"It's about Microsoft Excel"