Bonjour le FORUM
Je sollicite votre aide de nouveau
j'ai place ceci dans workbook
Function Age(d As Date) As String
Dim aa As Date, a&, m&, s&, j&
aa = Now()
RMMoteurs("contact!ad7:ad") = "18-04-2014"
If (d > 60) * (d <= aa) Then
Do While DateSerial(Year(d) + a + 1, Month(d), Day(d)) < aa: a = a + 1: Loop
Do While DateSerial(Year(d) + a, Month(d) + m + 1, Day(d)) < aa: m = m + 1: Loop
Do While DateSerial(Year(d) + a, Month(d) + m, Day(d) + (s + 1) * 7) < aa: s = s + 1: Loop '(semaines)
Do While DateSerial(Year(d) + a, Month(d) + m, Day(d) + s * 7 + j + 1) < aa: j = j + 1: Loop
Age = IIf(a, a & " an" & IIf(a > 1, "s", "") & " ", "") & IIf(m, m & " mois ", "") & IIf(s, s & " semaine" & IIf(s > 1, "s", "") & " ", "") & IIf(j Or (a + m + j = 0), j & " jour" & IIf(j > 1, "s", ""), "")
End If
End Function
et dans la feuille appellée contact
Private Sub Workbook_Open()
Range("A1") = "18-04-2014"
End Sub
cela fonctionne bien mais cela il ne se réactualise pas n ouvrant le classeur le lendemain
Est il possible de corriger ce petit souci ?
Par avance je vous remercie de votre aide
Je sollicite votre aide de nouveau
j'ai place ceci dans workbook
Function Age(d As Date) As String
Dim aa As Date, a&, m&, s&, j&
aa = Now()
RMMoteurs("contact!ad7:ad") = "18-04-2014"
If (d > 60) * (d <= aa) Then
Do While DateSerial(Year(d) + a + 1, Month(d), Day(d)) < aa: a = a + 1: Loop
Do While DateSerial(Year(d) + a, Month(d) + m + 1, Day(d)) < aa: m = m + 1: Loop
Do While DateSerial(Year(d) + a, Month(d) + m, Day(d) + (s + 1) * 7) < aa: s = s + 1: Loop '(semaines)
Do While DateSerial(Year(d) + a, Month(d) + m, Day(d) + s * 7 + j + 1) < aa: j = j + 1: Loop
Age = IIf(a, a & " an" & IIf(a > 1, "s", "") & " ", "") & IIf(m, m & " mois ", "") & IIf(s, s & " semaine" & IIf(s > 1, "s", "") & " ", "") & IIf(j Or (a + m + j = 0), j & " jour" & IIf(j > 1, "s", ""), "")
End If
End Function
et dans la feuille appellée contact
Private Sub Workbook_Open()
Range("A1") = "18-04-2014"
End Sub
cela fonctionne bien mais cela il ne se réactualise pas n ouvrant le classeur le lendemain
Est il possible de corriger ce petit souci ?
Par avance je vous remercie de votre aide