Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Way To Step Through Checkboxes
Folks,
Im hoping this is a simple question and Im just being dense. I have a user form with around 30 check boxes, to select different graphs to be displayed or hidden. I am wanting to cycle through the checkboxes and then for each, if the user has checked the box display the relevant series on the graphs. So the question is how do I step from checkbox to checkbox to determine its value. Thanks for any help, Andrew |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Way To Step Through Checkboxes
Hi,
Try this, Dim ctl As Object For Each ctl In userform1.Controls 'if within userform's codmodule 'For Each ctl In me.Controls If TypeName(ctl) = "CheckBox" Then If ctl.Value Then MsgBox ctl.Name & " : marked" End If Next Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Way To Step Through Checkboxes
hi,
Thats great. Thanks for the quick reply. Andrew *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Way To Step Through Checkboxes
Hi,
Not tested but try this: Dim myControl As MSForms.Control For Each myControl In myForm.Controls If TypeOf myControl Is MSForms.CheckBox Then 'something to do with myControl.Value End If 'typeof Next myControl regards Paul (Andrew) wrote in message . com... Folks, Im hoping this is a simple question and Im just being dense. I have a user form with around 30 check boxes, to select different graphs to be displayed or hidden. I am wanting to cycle through the checkboxes and then for each, if the user has checked the box display the relevant series on the graphs. So the question is how do I step from checkbox to checkbox to determine its value. Thanks for any help, Andrew |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Way To Step Through Checkboxes
Well, the Userform object has a Controls collection which you could
loop through and do a TypeOf comparison to test which are CheckBox. However, you would make things easier on yourself if in the form's _Activate event you put all the relevant checkboxes into your own Collection, array or similar, then you'd *know* where to look for them later. -- (Andrew) wrote in message . com... Folks, Im hoping this is a simple question and Im just being dense. I have a user form with around 30 check boxes, to select different graphs to be displayed or hidden. I am wanting to cycle through the checkboxes and then for each, if the user has checked the box display the relevant series on the graphs. So the question is how do I step from checkbox to checkbox to determine its value. Thanks for any help, Andrew |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need simple step by step help | Excel Discussion (Misc queries) | |||
Creating a Drop Down List with Step by Step Instructions for 2007 | Excel Worksheet Functions | |||
Need step by step to add invoice numbering to excel template | New Users to Excel | |||
how do you insert multiple simple checkboxes in an Excel Spreadshe | Excel Discussion (Misc queries) | |||
I need step by step instructions to create a macro for 10 imbedde. | Excel Worksheet Functions |