Reputation: 9393
Could anyone tell me how to reference a checkbox of the userform with a variable?
For example I have something like these,
if UserForm1.checkbox1.Value
if UserForm1.checkbox2.Value
if UserForm1.checkbox3.Value
I have to check nearly 40 to 50 checkboxes. But writing the 40 to 50 statements like these is time consuming and also makes a bigger code.
So I was kinda thinking to loop through them:
For i = 1 To 50
UserForm1.checkbox & i .Value
Next i
Something like that. I didn't find too much but I found it at the end. This is the link http://www.ozgrid.com/forum/showthread.php?t=43358 and the answer was like these,
UserForm1.Shapes("Checkbox" & i).Value
But it isn't working. Does any one know the way to do it? Is it possible? Any help is greatly appreciated.
Upvotes: 0
Views: 16224