Forms and Frames

  • Thread starter Thread starter Shunt
  • Start date Start date
S

Shunt

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!)
 
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.
 
-----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 ""
 
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
:-)
 
Tom Ogilvy wrote
The OP also said:


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.
 
Back
Top