Consulting

Results 1 to 2 of 2

Thread: Age Calculate from textobx

  1. #1
    VBAX Newbie
    Joined
    Nov 2015
    Posts
    1
    Location

    Question Age Calculate from textobx

    Is there anyway to calculate age between the textbox I mean I have onetextbox to let the user enter DOB (dd/mm/yyyy) and another textbox will popout the result of the age. I'm kindda new in VBA Excel would like some help ty

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Welcome to the forum!

    In your userform code:
    Private Sub TextBox1_Change()  Dim a() As String
      On Error Resume Next
      a() = Split(TextBox1.Value, "/")
      TextBox2.Value = DateDiff("yyyy", DateSerial(a(2), a(1), a(0)), Date) - 1
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •