ich habe das Problem in einer Beispieldatei beschrieben!
Danke Gruß DieterG
https://www.herber.de/bbs/user/6878.xls
Private Sub OK_Click()
Dim MSG As Integer
Dim DelName As String
Dim Delrow As Long
Dim Gruppe As String
MsgBox ActiveSheet.Name
If ComboBox1.ListIndex < 0 Then
MsgBox "Sie haben noch keinen Mitarbeiter ausgewählt!", 16, "Löschen"
Exit Sub
End If
DelName = ComboBox1
Gruppe = Cells(Range("B:B").Find(what:=DelName).Row, 1)
If WorksheetFunction.CountIf(Range("A:A"), Gruppe) < 3 Then
MsgBox "Es sind weniger als 3 Mitarbeiter in Gruppe " & Gruppe & " da! Löschen nicht möglich!"
Exit Sub
End If
MSG = MsgBox("Wollen Sie die Daten von >> " & DelName & " << wirklich löschen?", _
vbQuestion + vbYesNo, "Löschen")
If MSG = vbNo Then Exit Sub
Delrow = ComboBox1.ListIndex + 6
Rows(Delrow).Delete
Unload Me
End Sub
Private Sub UserForm_Activate()
If Not Intersect(ActiveCell, Range("Mitarbeiter")) Is Nothing Then
ComboBox1.Value = ActiveCell
End If
End Sub