Unchecking check boxes on exit

B

Brisbane Rob

I assume there must be a way of unchecking all checkboxes on exit but I
can't find it. VBA code? Anyone know?

Thanks
 
D

Dave Peterson

I'd uncheck them the next time the workbook opens. It makes life easier.

Where are the checkboxes (on a single worksheet?)

How were they created (from the Forms toolbar or the control toolbox toolbar)

Option Explicit
Sub auto_open()
Dim wks As Worksheet
Dim OLEObj As OLEObject

Set wks = Worksheets("sheet1")

If wks.CheckBoxes.Count > 0 Then
wks.CheckBoxes.Value = xlOff
End If

For Each OLEObj In wks.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
OLEObj.Object.Value = False
End If
Next OLEObj
End Sub
 
Top