![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 10:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com