Habe eine Listbox (Listbox1) in einer Userform (Kl). Nun möchte ich gerne WErte aus einem Tabellenblatt in die Listbox einfügen. Diese sollen in 12 Spalten nebeneinander in die Listbox eingetragen werden.
Funktioniert mit meinem Code auch super, bis zur Listbox-Spalte 11 (KL.ListBox1.ListCount - 1, 10). Da unterbricht das Makro mit Fehlermeldung:
Laufzeitfehler 380 Eigenschaft List konnte nicht gesetzt werden. Ungültiger Eigenschaftswert.
Hier die Prozedur:
Sub liste1()
KL.ListBox1.MultiSelect = fmMultiSelectMulti
KL.ListBox1.ListStyle = fmListStyleOption
anzahl = Application.WorksheetFunction.CountA(Sheets(6).Columns(1))
For schleife = 2 To anzahl
schleife = 1
KL.ListBox1.ColumnCount = 12
KL.ListBox1.AddItem
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 0) = Sheets(6).Cells(schleife, 3).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 1) = Sheets(6).Cells(schleife, 4).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 2) = Sheets(6).Cells(schleife, 8).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 3) = Sheets(6).Cells(schleife, 9).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 4) = Sheets(6).Cells(schleife, 11).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 5) = Sheets(6).Cells(schleife, 13).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 6) = Sheets(6).Cells(schleife, 12).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 7) = Sheets(6).Cells(schleife, 29).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 8) = Sheets(6).Cells(schleife, 30).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 9) = Sheets(6).Cells(schleife, 31).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 10) = Sheets(6).Cells(schleife, 32).Value
KL.ListBox1.List(KL.ListBox1.ListCount - 1, 11) = Sheets(6).Cells(schleife, 33).Value
Next schleife
End Sub
Habt ihr ne Idee, was ich falsch gemacht habe?
Gruß uli