Gruppe
Dialog
Problem
Bei Eingabe der vierstelligen Auftragsnummer in eine UserForm-TextBox sollen die entsprechenden Datensätze in eine UserForm-ListBox übernommen werden.
ClassModule: frmValues
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub txtValue_Change()
Dim arr() As Variant
Dim iRow As Integer, iCol As Integer, iCounter As Integer
If txtValue.TextLength = 4 Then
iRow = 2
Do Until IsEmpty(Cells(iRow, 1))
If Cells(iRow, 1) = txtValue.Text Then
iCounter = iCounter + 1
ReDim Preserve arr(1 To 4, 1 To iCounter)
For iCol = 1 To 4
arr(iCol, iCounter) = Cells(iRow, iCol).Value
Next iCol
End If
iRow = iRow + 1
Loop
lstValues.Column = arr
End If
End Sub
StandardModule: Modul1
Sub DialogAufruf()
frmValues.Show
End Sub