Hi all,
I have a useform with a couple of checkboxes on it. Upon activating the userform I would like to run a couple of checks on the checkboxes. I want to use a private sub for that and pass the checkbox as an object into that sub, but no matter how I do it, I get an error 424 Object required. Below is my code:
It fails on the Check_Active (chk) line in the Userform Activate sub.
Any help is appreciated.
I have a useform with a couple of checkboxes on it. Upon activating the userform I would like to run a couple of checks on the checkboxes. I want to use a private sub for that and pass the checkbox as an object into that sub, but no matter how I do it, I get an error 424 Object required. Below is my code:
VBA Code:
Private Sub UserForm_Activate()
Dim chk As MSForms.CheckBox
Set chk = UserForm4.CheckBox1
Check_Active (chk)
End Sub
VBA Code:
Sub Check_Active(cb As MSForms.CheckBox)
For Each v In Worksheets("Gebouw_eisen_nieuw").Range("D2:D" & Rows.Count)
If v > "" Then
If v = cb.Caption Then
cb.Value = True
cb.Tag = 1
Exit For
End If
Else:
cb.Value = False
cb.Tag = 0
Exit For
End If
Next
End Sub
It fails on the Check_Active (chk) line in the Userform Activate sub.
Any help is appreciated.