Sortierung nach datum geht nicht
17.07.2015 11:21:30
Max
mein aktuelles Problem betrifft dieses Programmcode:
Public Function CombiS(XZ As Long)
Dim lZeile As Long
If UserForm1.ComboBox1 = Tabelle1.Cells(XZ, 1).Value Then
With UserForm1.ListBox1
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Tabelle2.Cells(lZeile, 1) ""
If UserForm1.Suche2 = Trim(CStr(Tabelle2.Cells(lZeile, 1).Value)) Then
If Tabelle2.Cells(lZeile, 7).Value = Tabelle1.Cells(XZ, 1) Then
If Tabelle2.Cells(lZeile, 6).Value >= Date Then
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
End If
End If
End If
lZeile = lZeile + 1
Loop
End With
With UserForm1.ListBox2
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Tabelle2.Cells(lZeile, 1) ""
If UserForm1.Suche2 = Trim(CStr(Tabelle2.Cells(lZeile, 1).Value)) Then
If Tabelle2.Cells(lZeile, 7).Value = Tabelle1.Cells(XZ, 1) Then
If Tabelle2.Cells(lZeile, 6).Value >= Date Then
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
End If
End If
End If
lZeile = lZeile + 1
Loop
End With
End If
End Function
Wie in Zeile 14 und 35 zu erkennen ist soll das Datum das in Zeile lZeile und Spalte 7 steht in _
die ListBox aufgenommen werden wenn es ab Heute in der zukunft liegt. Leider funktioniert das _ in diesem Fall nicht aber in einer anderen Funktion geht es komischerweise nur das nicht noch mit Suche2 abgeglichen wird:
Public Function Combi(X As Long)
Dim lZeile As Long
If UserForm1.ComboBox1 = Tabelle1.Cells(X, 1).Value Then
With UserForm1.ListBox1
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Tabelle2.Cells(lZeile, 1) ""
If Tabelle2.Cells(lZeile, 6).Value >= Date Then
If Tabelle2.Cells(lZeile, 7).Value = Tabelle1.Cells(X, 1) Then
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
End If
End If
lZeile = lZeile + 1
Loop
End With
With UserForm1.ListBox2
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Tabelle2.Cells(lZeile, 1) ""
If Tabelle2.Cells(lZeile, 6).Value >= Date Then
If Tabelle2.Cells(lZeile, 7).Value = Tabelle1.Cells(X, 1) Then
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
End If
End If
lZeile = lZeile + 1
Loop
End With
End If
End Function
WARUM ist das so *Verzweifelt*
Vielen Dank schonmal