Dear all,
In have a working spreadsheet where data is inputted via a user form. On this form the current code uses the date of data entry (todays date) and the date of birth or a person. It then automatically calculates the age of the person and places this on the user form and is ultimately submitted to the spreadsheet. Currently the calculation is 'rounding up' the age. ie
todays date = 16/02/2022, Dob = 25/03/1998, current answer will be 24 years of age. when actually age is 23yrs plus 10 months.
Date81 = todays date
TextBox1 = date of birth
Age = calculated age of person
I only require a year and not y/m/d of the person
many thanks all in advance
Regards
In have a working spreadsheet where data is inputted via a user form. On this form the current code uses the date of data entry (todays date) and the date of birth or a person. It then automatically calculates the age of the person and places this on the user form and is ultimately submitted to the spreadsheet. Currently the calculation is 'rounding up' the age. ie
todays date = 16/02/2022, Dob = 25/03/1998, current answer will be 24 years of age. when actually age is 23yrs plus 10 months.
VBA Code:
'Calculates age automatically and enters into Me.Age field
If IsDate(Me.TextBox1.Value) Then
Me.Age.Value = DateDiff("yyyy", DateValue(TextBox1.Value), Me.date81)
End If
Date81 = todays date
TextBox1 = date of birth
Age = calculated age of person
I only require a year and not y/m/d of the person
many thanks all in advance
Regards