[B]Option Explicit
Function difdate(d As Date, Optional f As Date = 0) As String
[COLOR="Green"]' On doit avoir d<f.
' Si f est omis, f est la date du jour.[/COLOR]
Dim a As Integer, m As Integer, j As Integer
Application.Volatile
If f = 0 Then f = Date
If f < d Then Exit Function
Do While d < f
d = DateSerial(Year(d) + 1, Month(d), Day(d))
a = a + 1
Loop
If d > f Then d = DateSerial(Year(d) - 1, Month(d), Day(d)): a = a - 1
Do While d < f
d = DateSerial(Year(d), Month(d) + 1, Day(d))
m = m + 1
Loop
If d > f Then d = DateSerial(Year(d), Month(d) - 1, Day(d)): m = m - 1
Do While d < f
d = DateSerial(Year(d), Month(d), Day(d) + 1)
j = j + 1
Loop
j = j + 1 [COLOR="Green"]' ou 0 selon les goûts...[/COLOR]
difdate = IIf(a, a & " an" & IIf(a > 1, "s", ""), "") & IIf(m, " " & m & " mois", "") & IIf(j, " " & j & " jour" & IIf(j > 1, "s", ""), "")
End Function[/B]