auf die Schnelle noch mit AddItem kompletter Code für Userform:
Option Explicit
Dim arrList()
Private Sub ListboxLaden()
Dim arrTab(): arrTab = Fahrzeugbestand.ListObjects(1).DataBodyRange.Value
arrList = Application.Index(arrTab, Evaluate("row(1:" & UBound(arrTab, 1) & ")"), Array(1, 2, 5, 7))
With ListBoxCar
.ColumnCount = UBound(arrList, 2)
.ColumnWidths = Join(Array(100, 100, 50, 150), ";")
.List = arrList
End With
End Sub
Private Sub Suchen()
Dim i&, j&
ListBoxCar.Clear
For i = 1 To UBound(arrList)
If (Marke = "" Or InStr(1, arrList(i, 1), Marke, vbTextCompare) > 0) _
And (Model = "" Or InStr(1, arrList(i, 2), Model, vbTextCompare) > 0) _
Then
' Listbox mit Daten füllen
With ListBoxCar
.AddItem arrList(i, 1)
For j = 1 To .ColumnCount - 1
.Column(j, .ListCount - 1) = arrList(i, j + 1)
Next j
End With
i = i + 1
End If
Next i
End Sub
Private Sub Marke_Change()
Suchen
End Sub
Private Sub Model_Change()
Suchen
End Sub
Private Sub UserForm_Initialize()
ListboxLaden
End Sub
Gruß Uwe
|