Muhammad_Bilal
New Member
- Joined
- Sep 1, 2017
- Messages
- 14
I have a Userform having several Checkboxes and a Button to perform action.
I want to loop through all checkboxes, If the value of check box is true it should show its Caption in MsgBox. but my code return error.
Q2. Can I use do/loop to perform the same job, is there another method rather than `For Each`
I want to loop through all checkboxes, If the value of check box is true it should show its Caption in MsgBox. but my code return error.
Code:
Dim C As MSForms.Control
For Each C In Me.Controls '<--| loop through userform controls
If TypeName(C) = "CheckBox" Then
If Me.CheckBox.Value = True Then
MsgBox C.Name
End If
End If
Next C
Q2. Can I use do/loop to perform the same job, is there another method rather than `For Each`