looping through all checkbox's in a userform

S

strataguru

Hi,

I have 35 checkboxes in my userform.

For each checkbox that is true I will do 'x'.

Anyone know the syntax to loop through all the checkboxes?

Thanks,
Robin
 
V

Vasant Nanavati

Hi Robin:

Dim ctl As Control
For Each ctl In UserForm1.Controls
If TypeOf ctl Is MSForms.CheckBox Then
If ctl Then
'your code here
End If
End If
Next

Regards,

Vasant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top