Initiate a trigger for clearing a list of check boxes?

  • Thread starter Thread starter JGarland
  • Start date Start date
J

JGarland

I have a spreadsheet with a column of check boxes and I want to establish a
trigger to either check or uncheck all boxes at one time.
 
You can use two contol buttons to run the code below. One control button
with the value in the code to true and the other to false


Private Sub CommandButton1_Click()
'Set checkboxes to false
For Each shp In ActiveSheet.Shapes
If shp.OLEFormat.progID = "Forms.CheckBox.1" Then
Set chkbox = ActiveSheet.OLEObjects(shp.Name).Object
chkbox.Value = False
End If
Next
End Sub
Private Sub CommandButton2_Click()
'Set checkboxes true
For Each shp In ActiveSheet.Shapes
If shp.OLEFormat.progID = "Forms.CheckBox.1" Then
Set chkbox = ActiveSheet.OLEObjects(shp.Name).Object
chkbox.Value = True
End If
Next
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

Back
Top