AW: ComboBox nach Datum sortieren
24.10.2009 22:10:46
Gerd
Hallo Gerhard,
teste mal.
'Quelle: bst
Private Sub UserForm_Activate()
Dim lngZeile As Long
With Tabelle1
' Werte aus Spalte A einfügen
For lngZeile = 6 To .Cells(Rows.Count, 1).End(xlUp).Row
AddSorted ComboBox1, .Cells(lngZeile, 1).Value
Next
End With
ComboBox2.List = ComboBox1.List
End Sub
Private Sub AddSorted(Cbo As MSForms.ComboBox, ByVal strVal As String)
Dim lngIndex As Long
For lngIndex = 0 To Cbo.ListCount - 1
If CDate(Cbo.List(lngIndex)) >= CDate(strVal) Then
If CDate(Cbo.List(lngIndex)) CDate(strVal) Then Cbo.AddItem strVal, lngIndex
Exit Sub
End If
Next
Cbo.AddItem strVal
End Sub
Gruß Gerd