Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Hide command button

I have a command button to print a hidden worksheet.
I want to be able to hide the button based on a condition of a cell.
For example, if cell B6 = A, button is hidden, but if cell B6=B, button is
visible and active for print.
I saw a similar post on this but I could not figure out the code for my
application.
Please help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Hide command button

Marco,

I'm assuming that your condition cell (B6) and your command button are on
the same worksheet.

If Range("B6") = "A" Then
CommandButton1.Visible = True
ElseIf Range("B6") = "B" Then
CommandButton1.Visible = False
End If

Replace "CommandButton1" with whatever the name of your print button is. How
the value in B6 is changed will effect where you put that code. For example,
if B6 is modified from another worksheet (via a link) you could put that code
in the Worksheet_Activate section of the worksheet containing the command
button.

"MarcoR" wrote:

I have a command button to print a hidden worksheet.
I want to be able to hide the button based on a condition of a cell.
For example, if cell B6 = A, button is hidden, but if cell B6=B, button is
visible and active for print.
I saw a similar post on this but I could not figure out the code for my
application.
Please help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Hide command button

Cory,

Thank you so much.
It worked!

Marco.

"Cory" wrote:

Marco,

I'm assuming that your condition cell (B6) and your command button are on
the same worksheet.

If Range("B6") = "A" Then
CommandButton1.Visible = True
ElseIf Range("B6") = "B" Then
CommandButton1.Visible = False
End If

Replace "CommandButton1" with whatever the name of your print button is. How
the value in B6 is changed will effect where you put that code. For example,
if B6 is modified from another worksheet (via a link) you could put that code
in the Worksheet_Activate section of the worksheet containing the command
button.

"MarcoR" wrote:

I have a command button to print a hidden worksheet.
I want to be able to hide the button based on a condition of a cell.
For example, if cell B6 = A, button is hidden, but if cell B6=B, button is
visible and active for print.
I saw a similar post on this but I could not figure out the code for my
application.
Please help.

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 to show/hide a different worksheet Marilyn Excel Discussion (Misc queries) 1 April 22nd 09 03:37 AM
How do I hide a command button based on a condition? [email protected] Excel Programming 4 May 3rd 06 02:47 PM
Command Button to Hide/Unhide Rows Bea Excel Discussion (Misc queries) 4 March 16th 06 03:21 PM
how do you hide a forms command button Paul James[_3_] Excel Programming 4 September 5th 03 06:18 PM
Hide command button on worksheet Mohair Excel Programming 3 July 14th 03 11:06 PM


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