This handy VBA procedure is just to show you how we can calculate and display someone Age. To do this, of course we need to know their date of birth first, then simply using datediff and mod vba functions we can calculate how old is he/she.
Sub PersonAge()
Dim iYears As Integer, iMonths As Integer, iMonth As Integer
Dim dtDateofbirth As Date
dtDateofbirth = _
CDate(InputBox("Input your date of birth (yyyy-mm-dd)", "Date of birth"))
iYears = DateDiff("yyyy", CDate(dtDateofbirth), Date)
iMonths = (DateDiff("m", CDate(dtDateofbirth), Date)) Mod (iYears * 12)
MsgBox "Your age are " & iYears & " year(s) and " & iMonths & " month(s)"
End Sub
For this example, I use MsgBox and InputBox to get input and display the output data, but we can change it to worksheet cells reference if we want to integrate this calculation in our Excel Worksheet.
Pingback: ipad
Pingback: natural search engine optimization services
Pingback: natural search engine optimization
Pingback: Homepage
Pingback: free bingo hunter
Pingback: mio liquid water enhancer
Pingback: new music
Pingback: scrapebox auto approve
Pingback: Buy Comment Backlinks
Pingback: Scrapebox Auto Approve
Pingback: reverse mortgages
Pingback: how does reverse mortgage work
Pingback: poilsines keliones