meine Userform wird mit Werten aus einer Tabelle gefüllt.
Nun möchte ich dass die Userform noch sortiert wird. Und zwar nach der 3. Spalte, dem Datum.
Ist das möglich?
LG Tobi
Private Sub FillList()
Dim rng, var As Range
Dim Zahl, wert As Long
Dim tFirst, sFirst, GeNr As String
Dim Max, i As Integer
ListBox2.Clear
ListBox1.AddItem
ListBox1.List(i, 0) = "Hersteller"
ListBox1.List(i, 1) = "| Typ"
ListBox1.List(i, 2) = "| Seriennummer"
ListBox1.List(i, 3) = "| Datum"
ListBox1.List(i, 4) = "| Kosten"
ListBox1.List(i, 5) = "| Auftragsnummer"
Set rng = Workbooks("Auftrag.xls").Worksheets("Daten").Range("C:C") _
.Find(What:=txtSearch, LookIn:=xlValues, LookAt:=xlPart, After:=Range("C15000"))
If Not rng Is Nothing Then
sFirst = rng.Address
ListBox2.AddItem
ListBox2.List(i, 0) = rng.Offset(0, 1)
'ListBox2.List(i, 1) = "| " & rng.Offset(0, 1)
'ListBox2.List(i, 2) = "| " & rng.Offset(0, 1)
ListBox2.List(i, 3) = "| " & rng.Offset(0, 3)
ListBox2.List(i, 4) = "| " & rng.Offset(0, 108)
ListBox2.List(i, 5) = "| "
ListBox2.List(i, 6) = rng.Offset(0, -2)
i = i + 1
Do
Set rng = Workbooks("Auftrag.xls").Worksheets("Daten").Range("C:C").FindNext(After:=rng) _
If rng.Address = sFirst Then Exit Do
ListBox2.AddItem
ListBox2.List(i, 0) = rng.Offset(0, 1)
'ListBox2.List(i, 1) = "| " & rng.Offset(0, 1)
'ListBox2.List(i, 2) = "| " & rng.Offset(0, 1)
ListBox2.List(i, 3) = "| " & rng.Offset(0, 3)
ListBox2.List(i, 4) = "| " & rng.Offset(0, 108)
ListBox2.List(i, 5) = "| "
ListBox2.List(i, 6) = rng.Offset(0, -2)
i = i + 1
Loop