Gruppe
Dialog
Problem
Wie kann ich eine mehrspaltige UserForm-ListBox aus einer Tabelle so mit Werten füllen, dass Leerzeilen nicht berücksichtigt werden?
StandardModule: basMain
Sub CallForm()
frmMultiColumn.Show
End Sub
ClassModule: frmMultiColumn
Private Sub cmdInsert_Click()
Dim arr() As Variant
Dim iRowL As Integer, iRow As Integer, iCol As Integer, iRowU As Integer
lstMultiCol.Clear
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
If Not IsEmpty(Cells(iRow, 1)) Then
ReDim Preserve arr(0 To 2, 0 To iRowU)
arr(0, iRowU) = Cells(iRow, 1)
arr(1, iRowU) = Cells(iRow, 2)
arr(2, iRowU) = Cells(iRow, 3)
iRowU = iRowU + 1
End If
Next iRow
lstMultiCol.Column = arr
End Sub
Private Sub cmdWeiter_Click()
Unload Me
End Sub