Fonction age
castours
-
NHenry Messages postés 15219 Date d'inscription Statut Modérateur Dernière intervention -
NHenry Messages postés 15219 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour, Comment adapter cette fonction avec les champs Date() et Date/Nais pour obetenir l'age en année , mois , jour car je ne connais pas le vba
Trouver cette fonction sur internet
Public Function Age(d As Date) As String
Dim y1 As Integer, y0 As Integer, m1 As Integer, m0 As Integer
Dim d1 As Integer, d0 As Integer
d1 = Day(Date) ' date=date du jour
m1 = Month(Date)
y1 = Year(Date)
d0 = Day(d) ' D = date de naissance
m0 = Month(d)
y0 = Year(d)
If d0 > d1 Then m0 = m0 + 1
If m0 > m1 Then
y0 = y0 + 1
m1 = m1 + 12
End If
Age = (y1 - y0) & " ans, " & (m1 - m0) & " mois"
End Function
Je vous remercie
Trouver cette fonction sur internet
- CALCUL D'AGE **
Public Function Age(d As Date) As String
Dim y1 As Integer, y0 As Integer, m1 As Integer, m0 As Integer
Dim d1 As Integer, d0 As Integer
d1 = Day(Date) ' date=date du jour
m1 = Month(Date)
y1 = Year(Date)
d0 = Day(d) ' D = date de naissance
m0 = Month(d)
y0 = Year(d)
If d0 > d1 Then m0 = m0 + 1
If m0 > m1 Then
y0 = y0 + 1
m1 = m1 + 12
End If
Age = (y1 - y0) & " ans, " & (m1 - m0) & " mois"
End Function
Je vous remercie
A voir également:
- Fonction age
- Fonction si et - Guide
- Fonction miroir - Guide
- Casa de papel age ✓ - Forum Minecraft
- Fitness park age minimum ✓ - Forum Loisirs / Divertissements
- Age Casa de papel ✓ - Forum Cinéma / Télé