Private Sub SORT_DATE_COMBO()
Dim a() As String
Dim i As Long
Dim n As Long
n = Me.CESERCIZIO.ListCount - 1
ReDim a(n)
For i = 0 To n
a(i) = Me.CESERCIZIO.List(i)
Next i
a = SortAsDate(a)
Me.ComboBox2.Clear
For i = 0 To n
Me.ComboBox2.AddItem a(i)
Next i
End Sub
Function SortAsDate(ByVal a As Variant)
Dim i As Long
Dim j As Long
Dim Tmp As Variant
For i = LBound(a) To UBound(a) - 1
For j = i + 1 To UBound(a)
If DateSerial(Right(a(i), 4), Left(a(i), 2), 1) > DateSerial(Right(a(j), 4), Left(a(j), 2), 1) Then
Tmp = a(i)
a(i) = a(j)
a(j) = Tmp
End If
Next j
Next i
SortAsDate = a
End Function
Private Sub SORT_DATE_COMBO()
Dim a() As String
Dim i As Long
Dim n As Long
n = Me.CESERCIZIO.ListCount - 1
ReDim a(n)
For i = 0 To n
a(i) = Me.CESERCIZIO.List(i)
Next i
a = SortAsDate(a)
Me.ComboBox2.Clear
For i = 0 To n
Me.ComboBox2.AddItem a(i)
Next i
End Sub
Function SortAsDate(ByVal a As Variant)
Dim i As Long
Dim j As Long
Dim Tmp As Variant
For i = LBound(a) To UBound(a) - 1
For j = i + 1 To UBound(a)
If DateSerial(Right(a(i), 4), Left(a(i), 2), 1) > DateSerial(Right(a(j), 4), Left(a(j), 2), 1) Then
Tmp = a(i)
a(i) = a(j)
a(j) = Tmp
End If
Next j
Next i
SortAsDate = a
End Function
Private Sub SORT_DATE_COMBO()
Dim a() As String
Dim i As Long
Dim n As Long
n = Me.CESERCIZIO.ListCount - 1
ReDim a(n)
For i = 0 To n
a(i) = Me.CESERCIZIO.List(i)
Next i
a = SortAsDate(a)
Me.ComboBox2.Clear
For i = 0 To n
Me.ComboBox2.AddItem a(i)
Next i
End Sub
Function SortAsDate(ByVal a As Variant)
Dim i As Long
Dim j As Long
Dim Tmp As Variant
For i = LBound(a) To UBound(a) - 1
For j = i + 1 To UBound(a)
If DateSerial(Right(a(i), 4), Left(a(i), 2), 1) > DateSerial(Right(a(j), 4), Left(a(j), 2), 1) Then
Tmp = a(i)
a(i) = a(j)
a(j) = Tmp
End If
Next j
Next i
SortAsDate = a
End Function
BRO, i need to use this sort code for a date in combo with this format dd/mm/yyyy, can you modify...