AW: ListBox füllen
29.12.2015 22:02:20
Peter
Hallo Markus,
so sollte es funktionieren:
Private Sub ComboBox3_Change()
Dim strStart As String
Dim rngSpalte As Range
Dim WkSh As Worksheet
Dim rZelle As Range
Dim sFundst As String
If ComboBox2 "" Then
ListBox1.Clear
Set Treffer = Columns(1).Find(ComboBox1.Value, LookAt:=xlWhole)
If Not Treffer Is Nothing Then
strStart = Treffer.Address
Do
If Cells(Treffer.Row, 1) = ComboBox1 And Cells(Treffer.Row, 2) = ComboBox3 Then
ListBox1.AddItem Cells(Treffer.Row, 4)
End If
Set Treffer = Columns(1).FindNext(Treffer)
Loop While Not Treffer Is Nothing And Treffer.Address strStart
End If
Set Treffer = Nothing
Else
MsgBox "Bitte Produkt auswählen"
End If
Set WkSh = ThisWorkbook.Worksheets("Tabelle1")
With ListBox1
.Clear
Set rZelle = WkSh.Columns(2).Find(What:=ComboBox3.Value, LookAt:=xlWhole, LookIn:= _
xlValues)
If Not rZelle Is Nothing Then
sFundst = rZelle.Address
Do
If ComboBox1.Value = WkSh.Range("A" & rZelle.Row) And _
ComboBox2.Value = WkSh.Range("C" & rZelle.Row) Then _
.AddItem WkSh.Range("D" & rZelle.Row).Value
Set rZelle = WkSh.Columns(2).FindNext(rZelle)
Loop While Not rZelle Is Nothing And rZelle.Address sFundst
End If
End With
End Sub
Gruß Peter