• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Calculation of Age.

Hi,

please check it....

Code:
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
 
Last edited by a moderator:
@ achu, your code would be better if you posted with the code tags.
I have put them in for you.
 
Back
Top