each für Klassen
Alsatian
Userform
Private Sub UserForm_Activate()
Dim objControl As Control
Dim intIndex As Integer
For Each objControl In Controls
If TypeOf objControl Is MSForms.CheckBox And VBA.Left(objControl.name, 5) = "cb_mz" _
Then
intIndex = intIndex + 1
ReDim Preserve obj_cb(1 To intIndex)
Set obj_cb(intIndex) = New cls_cb
Set obj_cb(intIndex).prpSet_cb = objControl
End If
Next
End Sub
Klasse
Private WithEvents mobjcb As MSForms.CheckBox
Private cb As MSForms.CheckBox
Friend Property Set prpSet_cb(ByVal obj_cb As MSForms.CheckBox)
Set mobjcb = obj_cb
End Property
Private Sub mobjcb_change()
Call Merkmal_auswahl.Merkmal_auswahl(mobjcb)
End Sub
Das funktioniert soweit auch nur finde ich, dass es nicht sauber programmiert ist, da ich es nicht schaffe das ganze mit zbFor each box in obj_cb
zu lösen sonder den großen Umweg über
Modul
Sub Merkmal_auswahl(c_box As Object)
Dim cb As Control
For Each cb In frm_start.Controls
If VBA.Left(cb.name, 5) = "cb_mz" And c_box.Value = True Then
cb.Value = False
End If
Next
End Sub
gehen muss
kennt jemand dafür eine Lösung?
lg
PePe