ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Initiate a trigger for clearing a list of check boxes? (https://www.excelbanter.com/excel-worksheet-functions/203052-initiate-trigger-clearing-list-check-boxes.html)

JGarland

Initiate a trigger for clearing a list of check boxes?
 
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.

joel

Initiate a trigger for clearing a list of check boxes?
 
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

"JGarland" wrote:

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.



All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com