Tri Dates variable tableau
Bonjour, je n'arrive pas à trier par ordre croissant des dates placées dans une variable tableau de cette manière :
Code:
1 2 3 4 5
| Sub test()
Dim VariableDates(3) As Date
VariableDates(0) = "12/09/2011"
VariableDates(1) = "20/03/2004"
VariableDates(2) = "04/12/2011" |
Je voudrais faire une fonction qui me tri les dates par ordres croissant.
J'ai voulu adapter cette fonction d'un ancien topic (le miens) http://www.developpez.net/forums/d84...iable-tableau/
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Function tabTrie(maVart)
Dim Debut As Integer, Fin As Integer
Dim i As Integer, j As Integer
Dim temp
Debut = LBound(maVart)
Fin = UBound(maVart)
For i = Debut To Fin - 1
For j = i To Fin
If maVart(i) > maVart(j) Then
temp = maVart(j)
maVart(j) = maVart(i)
maVart(i) = temp
End If
Next j
Next i
tabTrie = maVart
End Function |
Sinon je pensais bidouiller et placer mes dates sur une feuille et trier avec excel... mais c'est pas très pro...
Merci de votre aide.