Hi,Hello,
I have a command button on an excel sheet that I want to make visible / invisible based on the results of a formula or value of a cell. How would I do this in VBA?
Thanks!
Private Sub Worksheet_Calculate()
'ActiveX button
If Range("A1").Value = 1 Then
Sheets("Sheet6").CommandButton1.Visible = False
Else
Sheets("Sheet6").CommandButton1.Visible = True
End If
End Sub
Private Sub Worksheet_Calculate()
'Forms Button
If Range("A1").Value = 1 Then
Sheets("Sheet6").Shapes("Button 4").Visible = msoFalse
Else
Sheets("Sheet6").Shapes("Button 4").Visible = msoTrue
End If
End Sub
Private Sub Worksheet_Activate()
' ActiveX button
If Range("A1").Value = 1 Then
Sheets("Sheet6").CommandButton1.Visible = False
Else
Sheets("Sheet6").CommandButton1.Visible = True
End If
End Sub
Private Sub Worksheet_Activate()
' Forms Button
If Range("A1").Value = 1 Then
Sheets("Sheet6").Shapes("Button 4").Visible = msoFalse
Else
Sheets("Sheet6").Shapes("Button 4").Visible = msoTrue
End If
End Sub