I have a userform and I need to loop through the checkboxes to perform a
variety of functions. I have named all of the checkboxes sequentially (cbk1,
cbk2, cbk3, etc.)
One function I need to perform is to change all of their values to false. I
believe this would require a For each...next statement, but I'm not sure how
to do it. There are 88 check boxes total (cbk1 to cbk88).
I believe I can perform the other functions as needed if I could get someone
to help me with the loop to change all of the checkbox values to false.
Any help is GREATLY appreciated. Thanks in advance.
Greg Maxey - 14 Jan 2007 02:59 GMT
Something like:
Private Sub CommandButton1_Click()
Dim oCntr As Control
For Each oCntr In Me.Controls
If TypeOf oCntr Is MSForms.CheckBox Then
oCntr = False
End If
Next
End Sub
Might work for you.

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> I have a userform and I need to loop through the checkboxes to
> perform a variety of functions. I have named all of the checkboxes
[quoted text clipped - 10 lines]
>
> Any help is GREATLY appreciated. Thanks in advance.
Helmut Weber - 14 Jan 2007 08:44 GMT
Hi,
see: http://tinyurl.com/rcyr4
for how to create an array of controls
on a vba-userform at runtime.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Frankbelly - 14 Jan 2007 19:09 GMT
This is perfect. Much thanks to you both!
> Hi,
>
> see: http://tinyurl.com/rcyr4
>
> for how to create an array of controls
> on a vba-userform at runtime.