ActiveSheet.Shapes("Button 1").Visible = False
CommandButton1.Enabled = False
Sub CheckBox1Test()
If ActiveSheet.CheckBoxes("Check Box 1").Value = xlOn Then
ActiveSheet.Shapes("Button 2").Visible = True
Else
ActiveSheet.Shapes("Button 2").Visible = False
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = "" Then
ActiveSheet.Shapes("Button 1").Visible = True
Else
ActiveSheet.Shapes("Button 1").Visible = False
End If
End Sub
You are trying to use the "Caption" of your button in place of the "Name" of the button. They are two different things.
To see the name of your button, Ctrl-click the button.
The objects name can be seen in the Name Box. (Left of the formula bar)
The below code will Enable the button named "Button 1" when cell A1 is empty. If A1 is not empty, the button will be in-visible.Right click sheet tabCode:Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = "" Then ActiveSheet.Shapes("Button 1").Visible = True Else ActiveSheet.Shapes("Button 1").Visible = False End If End Sub
Click "View Code"
Paste the code into the panel that opens. ("WorkSheet" Module)
Alt-Q to quit the VBA Editor.
This is event code. Any time a change is made on that worksheet the event "fires" the code. Cell A1 is checked and the code sets the Button 1 parameters accordingly.Right click sheet tab
Click "View Code"
Paste the code into the panel that opens. ("WorkSheet" Module)
Alt-Q to quit the VBA Editor.