Execute a macro automatically when checkbox is clicked

E

Ezequiel

Hi!

I have a macro that I need to be executed automatically when a checkbox
called checkbox1 is clicked.

I tried with a simple macro like

Private Sub CheckBox1_Click()
If CheckBoxes("CheckBox1").Value = 1 Then
Range("a4").Value = 12
End If
End Sub

that is located at the corresponding sheet. The macro works fine when I
executed step by step, but is not running automatically when I click on
CheckBox1

Any idea?

Thanks,

Ezequiel
 
J

Jacob Skaria

Private Sub CheckBox1_Change()
If CheckBox1.Value = True Then
Range("a4").Value = 12
End If
End Sub

If this post helps click Yes
 
E

Ezequiel

Hi! Is not working:

1. When I click on the checkbox1 in the spreadsheet nothing happens and
2. If I execute the macro step by step, in the "If CheckBox1.Value = True
Then" part I got an error saying : "Run-time error '424': Object required"

Thanks,

Ezequiel
 
P

Patrick Molloy

check that the code is on the sheet's code page
check that you're using the ActiveX control
check that the check box change event does fire the code

check that application.enableevents = True
 

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

Top