View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2407_] Rick Rothstein \(MVP - VB\)[_2407_] is offline
external usenet poster
 
Posts: 1
Default 'Uncheck button'

If the Check Boxes are the Forms type and located on the same
worksheet then you can attach this macro to your button. Copy this
code to a standard VBA module in your workbook's VBA project.

Sub ClearCheckBoxes()

Dim ChkBox As Object

For Each ChkBox In ActiveSheet.CheckBoxes
ChkBox.Value = xlOff
Next ChkBox

End Sub


Apparently the OP's CheckBoxes were ActiveX ones as he thank OssieMac for
his code; however, for your future reference, with CheckBoxes from the Forms
toolbar, you don't have to iterate each CheckBox individually to uncheck
them all, you can do it by executing a single line of code....

Sub ClearCheckBoxes()
ActiveSheet.CheckBoxes.Value = xlOff
End Sub

or, if on a sheet other than the ActiveSheet (Sheet1 for example)...

Sub ClearCheckBoxes()
Worksheets("Sheet1").CheckBoxes.Value = xlOff
End Sub

Rick