![]() |
Forms and Frames
Hiya
I have a Userform which contains a frame. This frame contains ten or so CheckBoxes. I am looking for a macro or function by which I can make all the boxes checked or unchecked. I was hoping I could reference to the frame's members rather than referring to each checkbox in turn. Is this possible? I would apprecaite any help (even an answer saying its not possible!) |
Forms and Frames
Add two option buttons to your form and use this code.
Private Sub OptionButton1_Click() Dim CB As Control For Each CB In Frame1.Controls If TypeOf CB Is msforms.CheckBox Then CB = True Else CB = False End If Next CB End Sub Private Sub OptionButton1_Click() Dim CB As Control For Each CB In Frame1.Controls If TypeOf CB Is msforms.CheckBox Then CB = True Else CB = False End If Next CB End Sub Now you can play with that and come up with what you really want. Chrissy. "Shunt" wrote in message ... Hiya I have a Userform which contains a frame. This frame contains ten or so CheckBoxes. I am looking for a macro or function by which I can make all the boxes checked or unchecked. I was hoping I could reference to the frame's members rather than referring to each checkbox in turn. Is this possible? I would apprecaite any help (even an answer saying its not possible!) |
Forms and Frames
-----Original Message----- Hiya I have a Userform which contains a frame. This frame contains ten or so CheckBoxes. I am looking for a macro or function by which I can make all the boxes checked or unchecked. I was hoping I could reference to the frame's members rather than referring to each checkbox in turn. Is this possible? I would apprecaite any help (even an answer saying its not possible!) . for x=1 to 10 userform1(checkbox & x).value = true next x not sure if checkbox needs to be in "" |
Forms and Frames
Hello
This will toggle all Checkboxes in Frame frChecks: Dim ctr As MSForms.CheckBox For Each ctr In Me.frChecks.Controls ctr.Value = Not ctr.Value Next ctr Heiko :-) "Shunt" wrote: Hiya I have a Userform which contains a frame. This frame contains ten or so CheckBoxes. I am looking for a macro or function by which I can make all the boxes checked or unchecked. I was hoping I could reference to the frame's members rather than referring to each checkbox in turn. Is this possible? I would apprecaite any help (even an answer saying its not possible!) |
Forms and Frames
But he did not want them to toggle - he wanted them all true
or all false. Chrissy. "Heiko" wrote in message ... Hello This will toggle all Checkboxes in Frame frChecks: Dim ctr As MSForms.CheckBox For Each ctr In Me.frChecks.Controls ctr.Value = Not ctr.Value Next ctr Heiko :-) "Shunt" wrote: Hiya I have a Userform which contains a frame. This frame contains ten or so CheckBoxes. I am looking for a macro or function by which I can make all the boxes checked or unchecked. I was hoping I could reference to the frame's members rather than referring to each checkbox in turn. Is this possible? I would apprecaite any help (even an answer saying its not possible!) |
Forms and Frames
Tom Ogilvy wrote
The OP also said: I was hoping I could reference to the frame's members rather than referring to each checkbox in turn. But got all giggly when you showed him/her how to refer "to each checkbox in turn." So he/she might get excited about how to toggle as well. <g So that is your motivation for being so helpful on these newsgroups - to get the readers all excited - ummmm, lets not go there. ;-) Chrissy. |
All times are GMT +1. The time now is 01:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com