Simple Question: Hiding a CommandButton

J

JasperBlaas

Hello,

I am really bad at writing VBA scripts and I want something very simpl
done in a sheet. The thing is I have a commandbutton that I only want t
be visible when a certain cell (which is only changed by a Drop Dow
box) contains the number "7". I know this should be pretty easy, but
just can't get the right code in there.

Can anyone please help? Thank you in advance,

Jasper Blaa
 
N

Norman Jones

Hi Jasper,

Right-click the sheet tab and paste the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Visible = Range("A1") = 7
End Sub


Change the cell refence and the name of the command button to accord with
your needs.
 
N

Norman Jones

Hi Jasper

Right-click the sheet tab | View Code | and paste ...


---
Regards,
Norman



Norman Jones said:
Hi Jasper,

Right-click the sheet tab and paste the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton1.Visible = Range("A1") = 7
End Sub


Change the cell refence and the name of the command button to accord with
your needs.
 
Top