PDA

View Full Version : Age Calculate from textobx



putterp
11-17-2015, 05:39 AM
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 :)

Kenneth Hobs
11-17-2015, 03:57 PM
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