Tuesday, December 4, 2018

Determine employee is eligible for insurance using datediff and Iif function in VBA,VBA Teacher Sourav,Kolkata 08910141720

I have an employee list with their date of birth ,I need to calculate whether they are below or above 40 years old  to determine if they are eligible for insurance,here is the vba code for that

If IsDate(Application.WorksheetFunction.VLookup(Me.Label1, [Emplist_dob], 15, 0)) Then

Label6.Caption = IIf(DateDiff("yyyy", Application.WorksheetFunction.VLookup(Me.Label1, [Emplist_dob], 15, 0), Date) >= 40, "Above 40 no insurance", "Below 40 eligible for insurance")

End If

No comments:

Post a Comment