vba loop through all activex checkboxes set to uncheck in Excel
Q191. In Excel, how can I loop through all ActiveX checkboxes in WorkSheet and set them to "Unchecked" status?
To do it in Excel, here is the answer:
- Option Explicit
- Sub UnCheckAllCheckBoxes()
- Dim objControl As Object
- For Each objControl In ActiveSheet.OLEObjects
- If TypeName(objControl.Object) = "CheckBox" Then
- objControl.Object.Value = False
- End If
- End Sub
a) Line 5 - Loop through all ActiveX controls in ActiveSheet.
b) Line 6 - Check if Type of Control Object is "CheckBox"
c) Line 7 - If Type of Control Object is "CheckBox", then set it to FALSE.