AW: Listbox füllen
11.09.2011 11:41:59
fcs
Hallo Martin,
hier 2 Beispiele
Gruß
Franz
Private Sub xxxUserForm_Initialize()
Dim wksData As Worksheet
Dim arrData, Zeile As Long, Spalte As Long, SpalteBox As Long
Set wksData = Worksheets("Daten")
'Listbox1 mit Daten aus Zellbereich füllen
With wksData
arrData = .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp).Offset(0, 6)).Value
End With
Me.ListBox1.List = arrData
'Daten für Listeneintrag zeilenweise übernehmen
With wksData
Me.ListBox2.Clear
For Zeile = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row
With Me.ListBox2
.AddItem wksData.Cells(Zeile, 1)
SpalteBox = 0
For Spalte = 2 To 3
SpalteBox = SpalteBox + 1
.List(.ListCount - 1, SpalteBox) = wksData.Cells(Zeile, Spalte)
Next
End With
Next
End With
End Sub