ich möchte eine ListBox (box_Bestand) mit Inhalten einer Tabelle füllen (tbl_Bestand). Die Box hat verschiedene Spalten, in die jeweils die Spalten der Bestandstabelle eingefügt werden.
Bis heute morgen hat folgender Code funktioniert, doch jetzt wird nur noch die erste Spalte gefü _
llt und ich weiß nicht mehr weiter:
Sub Box_Fuellen()
Dim strWidth As String
Dim ZeileBestand As Long
Dim LetzteZeileBestand As Long
LetzteZeileBestand = tbl_Bestand.Cells(Rows.Count, "A").End(xlUp).Row
With box_Bestand
.Clear
.ColumnCount = 9
strWidth = (.Width) / 9
.ColumnWidths = strWidth & ";" & strWidth + 20 & ";" & strWidth & ";" _
& strWidth - 20 & ";" & strWidth & ";" & strWidth & ";" _
& strWidth & ";" & strWidth & ";" & strWidth
For ZeileBestand = 2 To LetzteZeileBestand
.AddItem
.List(.ListCount - 1, 0) = tbl_Bestand.Cells(ZeileBestand, 1)
.List(.ListCount - 1, 1) = tbl_Bestand.Cells(ZeileBestand, 8)
.List(.ListCount - 1, 2) = tbl_Bestand.Cells(ZeileBestand, 9)
.List(.ListCount - 1, 3) = tbl_Bestand.Cells(ZeileBestand, 2)
.List(.ListCount - 1, 4) = tbl_Bestand.Cells(ZeileBestand, 3)
.List(.ListCount - 1, 5) = tbl_Bestand.Cells(ZeileBestand, 4)
.List(.ListCount - 1, 6) = tbl_Bestand.Cells(ZeileBestand, 5)
.List(.ListCount - 1, 7) = tbl_Bestand.Cells(ZeileBestand, 6)
.List(.ListCount - 1, 8) = tbl_Bestand.Cells(ZeileBestand, 7)
Next
End With
End Sub
Kann mir jemand helfen?
Viele Grüße
Lisa