Ashish Khobragade
New Member
When I am trying to find age using DATEDIF function in excel 2007 it is giving #value error.
If Date1 is later than Date2, DATEDIF will return a #NUM! error. If either Date1 or Date2 is not a valid date, DATEDIF will return a #VALUE error.
Private Sub CommandButton1_Click()
Dim name As String
Dim age As Date
Dim enddate As Date
Dim gender As String
Dim c As String
enddate = Range("A1").Value = Format("DD/MM/YYYY")
name = InputBox("Enter your name", "Please type What is your name")
gender = InputBox("Enter your Gender type", "Please Type Gender type ( Male/Female)")
If gender = "Male" Then
gender = "Mr."
Else
gender = "Mrs."
End If
age = InputBox("Enter Your Date of birth", "DD/MM/YYYY" & "- " & "Achyutanand")
c = Application.WorksheetFunction.Days360(age, Now()) / 360
MsgBox gender & " " & name & "-- " & "your Age is :" & "-" & Application.WorksheetFunction.Round(c, 0) & " " & "Years Only", vbMsgBoxHelpButton, "For Help Call :- Achyutanand"
End Sub