Simple Question: Hiding a CommandButton

  • Thread starter Thread starter JasperBlaas
  • Start date Start date
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
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top