Cycle through all Checkboxes on a worksheet

G

Guest

I would like to create a macro that will find all the checkbox controls (they
are all directX) on a worksheet and then check each one. If it is checked, I
would like it to run a macro with a name identical to the caption on the
checkbox.

How would I go about searching for checkboxes and compsosing a list of them?
 
G

Guest

Something like this perhaps...
Sub FindCheckboxes()
Dim obj As OLEObject

For Each obj In OLEObjects
If TypeOf obj.Object Is msforms.CheckBox Then
If obj.Object.Value = True Then Application.Run obj.Object.Caption
End If
Next obj
End Sub
 

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