-
UserForm CheckBoxes using variable for name
I have a form with 80 check boxes with the names assigned as ChkBx1, Chkbx2, Chkbx3 through Chkbx80. I would like to use a variable for the checkbox name to check the value of the check box. Such as:
[VBA]
For i = 1 to 80
CurrentChkBox = ?ChkBx? & i
CurVal = UserForm.CurrentChkBox
Next
[/VBA]
This will not work since CurrentChkBox is a string and not a control. How can I use a variable as a control name?
Thanks in advance
-
Len
Use the form's Controls collection.
[vba]
For i = 1 To 80
CurrentChkBox = ?ChkBx? & i
CurVal = Me.Controls(CurrentChkBox)
Next [/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules