Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Find checkboxes and then check them

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Find checkboxes and then check them

sorry code to do it......

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

--

Regards,
Nigel




"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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Find checkboxes and then check them

Thanks to both of you. One last question. Is it possible to extract the
location of the objects. More specifically, can you extract which cell
address or which row/col address the object is located by?

Thanks

RK

"Rick Rothstein (MVP - VB)" wrote:

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to Check Checkboxes Mike Excel Discussion (Misc queries) 1 September 7th 07 12:52 AM
How do I set Checkboxes where you can only check yes or no, not bo Paula Excel Worksheet Functions 2 March 6th 06 11:13 PM
How do I check/uncheck ten or odd Checkboxes by click on one check Ken Vo Excel Discussion (Misc queries) 5 January 4th 06 11:10 PM
Link Checkboxes and Grey out the Check Patrick Excel Programming 1 October 11th 05 06:30 PM
Can't check checkboxes in userform ... sometimes DFStoneJr Excel Programming 1 June 25th 04 02:19 AM


All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"