View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Find checkboxes and then check them

Your code seems to work fine... as long as you are using ActiveX CheckBox'es
(that is, ones you got from the Visual Basic Toolbar). If you got your
CheckBox'es from the Form's Toolbar, try this code...

ActiveSheet.CheckBoxes.Value = True

Rick


"ExcelMonkey" wrote in message
...
I am trying to loop through all the checkbox controls in a spreadsheet and
make sure they are all checked. Why is this not workin:

Sub FindCheckboxes()
Dim obj As OLEObject
For Each obj In OLEObjects
If TypeOf obj.Object Is msforms.CheckBox Then
obj.Object.Value = True
End If
Next obj
End Sub

Thanks

EM