Set all checkboxes on a form to "true"

  • Thread starter Thread starter Monica
  • Start date Start date
M

Monica

I have a button on my form that says "Check All". When
it's clicked I execute this code:

Checkbox1.Value = True
Checkbox2.Value = True
Checkbox3.Value = True
....

Is there a way to set all to true with fewer lines of code?

Thx.
 
Monica,

Assuming that they are Forms checkboxes, try

activesheet.checkboxes.value = xloff

If they are control toolbar checkboxes, try

Dim oleObj

For Each oleObj In ActiveSheet.OLEObjects
If TypeName(oleObj.Object) = "CheckBox" Then
oleObj.Object.Value = False
End If
Next

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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