How do I clear all Checkboxes on a worksheet on open

W

wapfu

Excel 2003.
When a worksheet opens I wish to be able to set all
checkboxes to false . There are 15 checkboxes on the
sheet.
Regards
 
W

Wapfu

Hi,
Checkboxes on the spreadsheet, generated from the control
toolbox.
I have a sheet where I have placed checkboxes, created by
the toolbox wizard and are identified as checkbox1 thru
checkbox15. They are not on a separate user form.
Kind Regards
Wapfu
 
D

Dick Kusleika

Wapfu

This sub will clear all the checkboxes on sheet1

Sub ClearAllCB()

Dim oleCheck As OLEObject

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

End Sub
 
W

Wapfu

Thanks,
Very very appreciated.
Warm Regards
Wapfu
-----Original Message-----
Wapfu

This sub will clear all the checkboxes on sheet1

Sub ClearAllCB()

Dim oleCheck As OLEObject

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

End Sub

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com




.
 
Top