|
Option Explicit
Private Sub UserForm_Initialize()
Dim iRow As Integer
'Anzahl Spalten in ComboBox
ComboBox1.ColumnCount = 4
'Breite der Spalten in ComboBox
ComboBox1.ColumnWidths = "2cm; 0,6cm; 3,5cm; 3cm"
'Anzahl Spalten in ListBox
ListBox1.ColumnCount = 4
'Breite der Spalten in ListBox
ListBox1.ColumnWidths = "0,6cm; 2cm; 3,5cm; 3cm"
'For/Next-Schleife zum Füllen der Objekte
For iRow = 3 To Range("B65536").End(xlUp).Row
'ComboBox mit Mandantennamen füllen
'1.Spalte mit Daten aus Spalte B
ComboBox1.AddItem Cells(iRow, 3)
'2.Spalte mit Daten aus Spalte C
ComboBox1.List(ComboBox1.ListCount - 1, 1) = Cells(iRow, 2)
'3.Spalte mit Daten aus Spalte D
ComboBox1.List(ComboBox1.ListCount - 1, 2) = Cells(iRow, 4)
'4.Spalte mit Daten aus Spalte E
ComboBox1.List(ComboBox1.ListCount - 1, 3) = Cells(iRow, 5)
'Listbox mit Mandantennamen füllen
'1.Spalte mit Daten aus Spalte B
ListBox1.AddItem Cells(iRow, 2)
'2.Spalte mit Daten aus Spalte C
ListBox1.List(ListBox1.ListCount - 1, 1) = Cells(iRow, 3)
'3.Spalte mit Daten aus Spalte D
ListBox1.List(ListBox1.ListCount - 1, 2) = Cells(iRow, 4)
'4.Spalte mit Daten aus Spalte E
ListBox1.List(ListBox1.ListCount - 1, 3) = Cells(iRow, 5)
Next
End Sub
|