ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Buttons When a Cell is False (https://www.excelbanter.com/excel-programming/404962-hide-buttons-when-cell-false.html)

[email protected]

Hide Buttons When a Cell is False
 
Is there a way to hide and unhide buttons when a cell is true/false? I use
this all the time for regular formulas within excel, but am not sure if it is
possible to hide actual buttons. Any help would be greatly apreciated.

Thanks

Adam Bush


Rick Rothstein \(MVP - VB\)

Hide Buttons When a Cell is False
 
Assuming for this example that the cell you want to monitor is A1, this
Worksheet Change event code should do what you want; it makes the
CommandButton (what you are using, right?) visible if and only if the value
in the cell is TRUE...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") Then CommandButton1.Visible = Target.Value = "True"
End Sub

This version makes the CommandButton visible is the cell contains **any**
entry...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") Then CommandButton1.Visible = Target.Value < ""
End Sub

Rick


"
m wrote in message
...
Is there a way to hide and unhide buttons when a cell is true/false? I
use
this all the time for regular formulas within excel, but am not sure if it
is
possible to hide actual buttons. Any help would be greatly apreciated.

Thanks

Adam Bush



[email protected]

Hide Buttons When a Cell is False
 
Rick,

Great! Thanks for your help. I appreciate the speedy response.

Thanks

Adam Bush

"Rick Rothstein (MVP - VB)" wrote:

Assuming for this example that the cell you want to monitor is A1, this
Worksheet Change event code should do what you want; it makes the
CommandButton (what you are using, right?) visible if and only if the value
in the cell is TRUE...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") Then CommandButton1.Visible = Target.Value = "True"
End Sub

This version makes the CommandButton visible is the cell contains **any**
entry...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") Then CommandButton1.Visible = Target.Value < ""
End Sub

Rick


"
m wrote in message
...
Is there a way to hide and unhide buttons when a cell is true/false? I
use
this all the time for regular formulas within excel, but am not sure if it
is
possible to hide actual buttons. Any help would be greatly apreciated.

Thanks

Adam Bush





All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com