S
Shamsul
Hi
I'am trying to write code for a number of Checkboxes in a
Userform.
I don't want to repeat the code for each checkbox. I tried
to use the code below, but it didn't work. Can someone
please advise.
Dim ctrl As Control
Dim inct As Long
Dim X As Long
icnt = 0
For Each ctrl In UserForm2.Controls
If TypeOf ctrl Is MSForms.CheckBox Then
icnt = icnt + 1
End If
Next
MsgBox "there are " & icnt & " checboxes"
Range("S3").Select
For X = 1 To icnt
If CheckBoxX = True Then
ActiveCell.FormulaR1C1 = "YES"
ActiveCell.Offset.Select
End If
Next X
I'am trying to write code for a number of Checkboxes in a
Userform.
I don't want to repeat the code for each checkbox. I tried
to use the code below, but it didn't work. Can someone
please advise.
Dim ctrl As Control
Dim inct As Long
Dim X As Long
icnt = 0
For Each ctrl In UserForm2.Controls
If TypeOf ctrl Is MSForms.CheckBox Then
icnt = icnt + 1
End If
Next
MsgBox "there are " & icnt & " checboxes"
Range("S3").Select
For X = 1 To icnt
If CheckBoxX = True Then
ActiveCell.FormulaR1C1 = "YES"
ActiveCell.Offset.Select
End If
Next X