I'm new to VBA so please be gentle when reviewing my code. When I run the code - the checkboxes display as they should - but nothing happens when I click on them. I've been reading just about every internet article on this subject - hopefully what I have is "close" and I'm on the right track. Once I have this test working I can get more specific on what each checkbox does.

Thanks!

Here is my CLASS (clsBoxEvent) code:
Option Explicit

Public WithEvents ckbEvent1 As MSForms.CheckBox
Public WithEvents cbEvent1 As MSForms.CommandButton

Private Sub cbEvent1_click()

MsgBox "Yes"

End Sub


Private Sub ckbEvent1_click()

MsgBox "YesYes"

End Sub

Here is my userform code:

Option Explicit

Private Sub UserForm_Initialize()
Dim cmdB1 As MSForms.CommandButton
Dim chkB1 As MSForms.CheckBox
Dim chkBoxColl As New Collection
Dim cmdBoxColl As New Collection
Dim chkBoxEvent As clsBoxEvent
Dim cmdBoxEvent As clsBoxEvent
Dim cmdB_loc As Integer
Dim i As Integer
Dim j As Integer
Dim x_array(50) As String
Dim index As Integer
Dim array_size As Integer
Dim ws As Worksheet
Dim rowcnt As Integer
'===================================================

index = 1
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Forms" And ws.Name <> "Marks SQL" And ws.Name <> "Recap" And ws.Name <> "FormData" And ws.Name <> "Decommissioned" And ws.Name <> "template" Then
x_array(index) = ws.Name
index = index + 1
End If
Next ws

rowcnt = index / 3
array_size = index
index = 1
For j = 1 To 3
For i = 1 To rowcnt
If index = array_size Then
Exit For
Exit For
End If
Set chkB1 = Controls.Add("Forms.CheckBox.1")
chkB1.Name = "chk" & x_array(index): chkB1.Top = (i * 25) + 15: chkB1.Left = (j * 80) - 50: chkB1.Font = "Arial": chkB1.Caption = x_array(index)
Set chkBoxEvent = New clsBoxEvent
Set chkBoxEvent.ckbEvent1 = Me.Controls(chkB1.Name)
chkBoxColl.Add chkBoxEvent
index = index + 1
Next i
Next j

cmdB_loc = rowcnt * 33
Set cmdB1 = Me.Controls.Add("Forms.CommandButton.1")
cmdB1.Name = "btnContinue"
cmdB1.Caption = "Continue?"
cmdB1.Top = cmdB_loc
cmdB1.Left = 10
Set cmdBoxEvent = New clsBoxEvent
Set cmdBoxEvent.cbEvent1 = Me.Controls(cmdB1.Name)
cmdBoxColl.Add cmdBoxEvent

Set cmdB1 = Me.Controls.Add("Forms.CommandButton.1")
cmdB1.Name = "btnCancel"
cmdB1.Caption = "Cancel"
cmdB1.Top = cmdB_loc
cmdB1.Left = 120
Set cmdBoxEvent = New clsBoxEvent
Set cmdBoxEvent.cbEvent1 = Me.Controls(cmdB1.Name)
cmdBoxColl.Add cmdBoxEvent


End Sub