Re : Nombre de jour entre aujourd'hui et la date d'anniversaire
Bonjour Habitude, tout d'abord merci pour ta réponse
sans avoir eu le temps de regarder ta solution car l'ordinateur était déja eteint, j'ai réussi ce matin à trouver une solution similaire à la tienne, et cela fonctionne:
With Sheets("rensprivés")
Dim moisanniv, jouranniv As Byte
Dim ans As Integer
For i = 2 To .Range("A65536").End(xlUp).Row
If .Cells(i, 8).Value <> "" Then
moisanniv = Month(.Cells(i, 8).Value)
jouranniv = Day(.Cells(i, 8).Value)
ans = Year(Date)
Nbjour = DateDiff("d", jouranniv & "/" & moisanniv & "/" & ans, Date)
If Nbjour = 2 Then
If LstNoms8(1, 1) <> "" Then ReDim Preserve LstNoms8(1 To 3, 1 To UBound(LstNoms8, 2) + 1)
LstNoms8(1, UBound(LstNoms8, 2)) = .Cells(i, 1).Value
LstNoms8(2, UBound(LstNoms8, 2)) = .Cells(i, 2).Value
LstNoms8(3, UBound(LstNoms8, 2)) = "Après demain"
ElseIf Nbjour = 1 Then
If LstNoms8(1, 1) <> "" Then ReDim Preserve LstNoms8(1 To 3, 1 To UBound(LstNoms8, 2) + 1)
LstNoms8(1, UBound(LstNoms8, 2)) = .Cells(i, 1).Value
LstNoms8(2, UBound(LstNoms8, 2)) = .Cells(i, 2).Value
LstNoms8(3, UBound(LstNoms8, 2)) = "Demain"
ElseIf Nbjour = 0 Then
If LstNoms8(1, 1) <> "" Then ReDim Preserve LstNoms8(1 To 3, 1 To UBound(LstNoms8, 2) + 1)
LstNoms8(1, UBound(LstNoms8, 2)) = .Cells(i, 1).Value
LstNoms8(2, UBound(LstNoms8, 2)) = .Cells(i, 2).Value
LstNoms8(3, UBound(LstNoms8, 2)) = "Aujourd'hui"
End If
End If
Next i
Me.ListBox8.Column = LstNoms8
End With
Il me reste plus qu'à classer les dates dans la listbox en croissant et normalement le tour est joué, merci de ton aide,
@+