P
PJ Murph
I have the following code in a module (Module1):
Option Explicit
Dim ChkBoxes() As New Class1
Sub Autpen()
Dim CBXCount As Long
Dim OLEObj As OLEObject
CBXCount = 0
For Each OLEObj In Worksheets("DAL").OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
CBXCount = CBXCount + 1
ReDim Preserve ChkBoxes(1 To CBXCount)
Set ChkBoxes(CBXCount).CBXGroup = OLEObj.Object
End If
Next OLEObj
End Sub
I have the following code in a Class Module (Class1):
Public WithEvents CBXGroup As MSForms.CheckBox
Private Sub CBXGroup_Change()
Dim WhichCheck As Long
WhichCheck = Mid(CBXGroup.Name, Len("cbxCheck") + 1)
With CBXGroup.Parent.OLEObjects("tbxCheck" & WhichCheck)
.Visible = CBXGroup.Value
.PrintObject = CBXGroup.Value
End With
End Sub
This works perfectly for the checks presented portion of my form. The
problem is that I have 3 different checkboxes; cbxCheck, cbxFee, and cbxHeld.
How do I code to track and differentiate all 3?
Option Explicit
Dim ChkBoxes() As New Class1
Sub Autpen()
Dim CBXCount As Long
Dim OLEObj As OLEObject
CBXCount = 0
For Each OLEObj In Worksheets("DAL").OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
CBXCount = CBXCount + 1
ReDim Preserve ChkBoxes(1 To CBXCount)
Set ChkBoxes(CBXCount).CBXGroup = OLEObj.Object
End If
Next OLEObj
End Sub
I have the following code in a Class Module (Class1):
Public WithEvents CBXGroup As MSForms.CheckBox
Private Sub CBXGroup_Change()
Dim WhichCheck As Long
WhichCheck = Mid(CBXGroup.Name, Len("cbxCheck") + 1)
With CBXGroup.Parent.OLEObjects("tbxCheck" & WhichCheck)
.Visible = CBXGroup.Value
.PrintObject = CBXGroup.Value
End With
End Sub
This works perfectly for the checks presented portion of my form. The
problem is that I have 3 different checkboxes; cbxCheck, cbxFee, and cbxHeld.
How do I code to track and differentiate all 3?