AW: Userform +Listbox nach Kriterium füllen
Hans
Hallo Harald,
es ist empfehlenswert, UserForm-Steuerelemente ungebunden zu verwenden und die Werte einzulesen.
Der Code zum Problem:
Sub UserForm_Initialize()
Dim arr() As String
Dim iRowL As Integer, iRow As Integer, iCounter As Integer, iCol As Integer
Me.Caption = "offene Punkte"
Me.Width = Application.UsableWidth
Me.Height = Application.UsableWidth
With Worksheets(2)
iRowL = .Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 3 To iRowL
If IsEmpty(Cells(iRow, 8)) Then
iCounter = iCounter + 1
ReDim Preserve arr(1 To 7, 1 To iCounter)
For iCol = 1 To 7
arr(iCol, iCounter) = Cells(iRow, iCol).Value
Next iCol
End If
Next iRow
End With
With ListBox1
.ColumnCount = 7
.ColumnHeads = True
.ColumnWidths = "2cm;2cm;2cm;0cm;2cm;3cm;0cm;0cm"
.Column = arr
End With
End Sub
Gruss hans