Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loop through checkBox on worksheet


I have created some user forms that gather information into a worksheet.
The worksheet has checkboxes that gets set based on the answers from
the user form. I used the checkboxes from the control toolbox. I have
mutiple checkboxes in some cells.
Question: How can I loop through the checkboxes in the worksheet and
set the enable property to false. I know how you can do this on a user
form with controls but not sure how on a worksheet.
Thanks in advance for any help!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Loop through checkBox on worksheet

Try this

Sub test2()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = True
End If
Next
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"bman" wrote in message ...

I have created some user forms that gather information into a worksheet.
The worksheet has checkboxes that gets set based on the answers from
the user form. I used the checkboxes from the control toolbox. I have
mutiple checkboxes in some cells.
Question: How can I loop through the checkboxes in the worksheet and
set the enable property to false. I know how you can do this on a user
form with controls but not sure how on a worksheet.
Thanks in advance for any help!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Loop through checkBox on worksheet

Oops

Change it to False

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message ...
Try this

Sub test2()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = True
End If
Next
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"bman" wrote in message ...

I have created some user forms that gather information into a worksheet.
The worksheet has checkboxes that gets set based on the answers from
the user form. I used the checkboxes from the control toolbox. I have
mutiple checkboxes in some cells.
Question: How can I loop through the checkboxes in the worksheet and
set the enable property to false. I know how you can do this on a user
form with controls but not sure how on a worksheet.
Thanks in advance for any help!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loop through checkBox on worksheet


Thanks for the info. I just made a few changes to accomodate the enabl
part.
Sub test2()
Dim mycheck As MSForms.CheckBox
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
Set mycheck = obj.Object
mycheck.Enabled = False
End If
Next
End Sub

Appreciate your help

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

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
checkbox in a protected worksheet Eric Wixom Excel Worksheet Functions 2 January 11th 08 04:15 PM
checkbox and worksheet Jenn Excel Discussion (Misc queries) 2 June 26th 06 04:38 PM
How? Macro to copy range to new worksheet, name new worksheet, loop Repoman Excel Programming 9 October 9th 03 01:45 PM
For loop for Checkbox Tom Ogilvy Excel Programming 0 August 27th 03 01:03 AM
For loop for Checkbox Jake Marx Excel Programming 0 August 27th 03 12:23 AM


All times are GMT +1. The time now is 02:14 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"