confusion123
Active Member
- Joined
- Jul 27, 2014
- Messages
- 400
My worksheet has many checkboxes and instead of writing the following:
I want to put it in a class.
So far, I have this in a standard module:
and this in Class1:
My question is, what should replace the ?????
I've tried MS.Forms.Checkbox or simply checkbox but neither worked.
Thanks
Code:
Private Sub chk1_Click()
End Sub
Private Sub chk2_Click()
End Sub
etc.
I want to put it in a class.
So far, I have this in a standard module:
Code:
Dim MyCheck() As Class1
Dim ChkCount As Integer
Dim Ctl As Shape ' NOT SURE IF I SHOULD DECLARE AS SHAPE OR SOMETHING ELSE
ChkCount = 0
For Each Ctl In Sheet4.Shapes
If Left(Ctl.Name, 3) = "chk" Then ChkCount = ChkCount + 1
Next Ctl
ReDim MyCheck(1 To ChkCount) As Class1
ChkCount = 0
For Each Ctl In Sheet4.Shapes
If Left(Ctl.Name, 3) = "chk" Then
ChkCount = ChkCount + 1
Set MyCheck(ChkCount) = New Class1
Set MyCheck(ChkCount).abc = Ctl
End If
Next Ctl
and this in Class1:
Code:
Option Explicit
Public WithEvents CheckGroup As ?????
Private Sub CheckGroup_Click()
End Sub
My question is, what should replace the ?????
I've tried MS.Forms.Checkbox or simply checkbox but neither worked.
Thanks