die Prüfung ob ein OptionButton in einer Gruppe wahr ist funktioniert leider nicht.
In beiliegender Mappe auch noch eine andere Variante die leider auch nicht die Lösung bringt.
Danke, für Eure Hilfe!
Gruß
Sigi
https://www.herber.de/bbs/user/123165.xlsm
Private Sub CommandButton1_Click()
With U1
bytZaehler = 0
For Each cb In .Controls
Select Case TypeName(cb)
Case "OptionButton"
If Left(cb.Name, 8) = "optStamm" And cb.GroupName = "KD" Then
lxl = 0
For lol = 1 To 2
If cb.Value = True Then
lxl = lxl + 1
End If
Next
End If
If lxl = 0 Then
sTeilName = "Kundengruppe"
GoTo msg
End If
If Left(cb.Name, 8) = "optStamm" And cb.GroupName = "P" Then
lxl = 0
For lol = 1 To 2
If cb.Value = True Then
lxl = lxl + 1
End If
Next
End If
If lxl = 0 Then
sTeilName = "Privatgruppe"
GoTo msg
End If
End Select
Next cb
If lxl = 2 Then GoTo 0
msg:
MsgBox "Sie haben in der Gruppe " & sTeilName & " nichts ausgewählt"
End With
0 End Sub