![]() |
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/ |
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/ |
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/ |
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 |
All times are GMT +1. The time now is 06:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com