Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Loop through checkboxes on a userform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frankbelly - 14 Jan 2007 02:29 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.