Check If Year Is A Leap Year

'This program will return 'True' if the year is a leap year, and return False if not.
'Insert the following code to your form:

Public Function IsLeapYear(iYear As Integer)
If (iYear Mod 4 = 0) And _
((iYear Mod 100 <> 0) Or (iYear Mod 400 = 0)) Then
IsLeapYear = True
IsLeapYear = False
End If
End Function

Private Sub Form_Load()
'Replace '1980' with the year you want to check
MsgBox IsLeapYear(1980)
End Sub

Go Back