ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   BUTTONS (https://www.excelbanter.com/excel-programming/329048-buttons.html)

glenn

BUTTONS
 
I know how to assign a button to a macro. My question is:

How can I make that Buttom hide until a particular cell result is true.

Thanks, Glenn

Zack Barresse

BUTTONS
 
Hi Glenn,

Use something like this ...

Option Explicit
Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Target.Address = "$A$1" Then '<<== CHANGE!
Application.EnableEvents = False
If Target.Value = "True" Then
Shapes("Button 1").Visible = True '<< CHANGE!
Else
Shapes("Button 1").Visible = False'<< CHANGE!
End If
Application.EnableEvents = True
End If
End Sub


To install:
Right click sheet tab (name)
Select View Code
Paste on right
Change Button name (2 places)
Change Target Address (from A1)
Alt + Q returns to Excel
SAVE FIRST!

--
Regards,
Zack Barresse, aka firefytr

"Glenn" wrote in message
...
I know how to assign a button to a macro. My question is:

How can I make that Buttom hide until a particular cell result is true.

Thanks, Glenn





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

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