Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tick a check box to run a macro

Status
Not open for further replies.

Anna22

Technical User
Feb 11, 2002
56
GB
Dear All

I have been puzzling about this one for some hours now and im struggling, I have an excel spreadsheet with check boxes on it. The checkboxes run fine but what i want it to do is when i click a check box i want it to run a macro....

is this possible?

All help is greatly appreciated

Regards Anna
 
Hi
Have you checked out the edit code icon, beside the properties icon, on the forms toolbar?
 
I am trying to use VBA to run the macro

i had the following code in my head but cant seem to get it to work

if checkbox1 = true then
run macro
else
do nothing
end if

would it be as simple as this or more in depth

Thanks Anna
 

Where did you get the checkbox?

If you used the "Control Toolbox" toolbar, then just double click on the checkbox (in Design Mode) and put your code in the space indicated:
[tt]
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Call MyMacro
End If
End Sub
[/tt]

If you used the "Forms" toolbar then it's a bit more complicated, but it can still be done.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top