rpaulson
Well-known Member
- Joined
- Oct 4, 2007
- Messages
- 1,411
I have the following code in my Private Sub UserForm_initialize() section of my user form.
It will programmatically create many check boxes. this part actually works as planned.
the issue is, I do not know how to trigger a click event
The below does not seem to work:
any ideas?
Thanks,
Ross
It will programmatically create many check boxes. this part actually works as planned.
VBA Code:
r = 1
For c = 2 To 14
Set chkBox = Me.Controls.Add("Forms.CheckBox.1", "CheckBox_" & c)
chkBox.Caption = Cells(10, c).Value
chkBox.Left = 500
chkBox.Top = 50 + ((r - 1) * 20)
If Columns(c).ColumnWidth = 0 Then chkBox.Value = True 'delaut check boxes to true if data in row 11
r = r + 1
Next c
the issue is, I do not know how to trigger a click event
The below does not seem to work:
VBA Code:
Private Sub CheckBox_3_Click()
MsgBox "Box 3 clicked"
End Sub
any ideas?
Thanks,
Ross