I have used the following VBA code to calculate age on a specific date. With this VBA code i can only get difference only in years.
How can I get the age in format of "XX Years, YY Months, ZZ Days"
Sub ageCalculator()
Sheet2.Select
Range("a2").Select
Dim w As Date
Dim x As Date
w = InputBox("Enter Date of Birth")
x = InputBox("Enter <age on> date")
Range("a2").Value = DateDiff("yyyy", w, x) & "Years"
End Sub
If I add & DateDiff("yyyymm", w, x) & "Months" & DateDiff("mmdd", w, x) & "Days"
it says Run-time error "5":
How can I get age or difference of two dates as above mentioned formate?
I came up with the following:
Try playing with something like this