How to select checkBoxes as a group in

  • Thread starter Thread starter Fendic
  • Start date Start date
F

Fendic

hi, does anyone know how to select checkBoxes as a group by programmin
in Excel VBA?

I need to programm a 'checkAll' checkBox to set all checkBox value t
be true. how can I control them as a group?

Thanks a lot.
Fendic :
 
With your "checkall" checkbox being "checkbox1", try this in a standard module:

Private Sub CheckBox1_Click()
Dim OLEobj As OLEObject
For Each OLEobj In ActiveSheet.OLEObjects
If TypeOf OLEobj.Object Is MSForms.CheckBox Then
If OLEobj.Name <> "CheckBox1" Then
OLEobj.Object.Value = ActiveSheet.OLEObjects("CheckBox1"). _
Object.Value
End If
End If
Next OLEobj
End Sub
---
To use, press ALT+F11. Go to Insert > Module. Paste in the code. Press ALT+Q.

HTH
Jason
Atlanta, GA
 

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