View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
John Coleman John Coleman is offline
external usenet poster
 
Posts: 274
Default Looping through checkboxes

On Jan 6, 11:36*am, Gord Dibben wrote:
For Each mychkbox In wks.CheckBoxes
* * * * With mychkbox
* * * * * .Value = True
* * * * End With
* * Next mychkbox

Gord


That seems to work for form controls but not ActiveX controls. It also
seems to be poorly documented (e.g. doesn't appear in the object
browser for worksheet methods) so thanks for pointing it out.



On Fri, 6 Jan 2012 05:59:54 -0800 (PST), jkrons wrote:
I have the line of code


Sheets(1).OLEObjects("CheckBox1").Object.Value = True


that works great, but how do I loop through all the checkboxes in my
sheet with something like this


For Each cb In Sheets(1).OLEObjects.CheckBoxes
Sheets(1).OLEObjects(cb.Name).Object.Value = True


I get a runtime error 430 Object doesn't support this property or
method.


How do I loop through the checkboxes?- Hide quoted text -


- Show quoted text -