Private Sub IsLeapYearTest() ' Test the IsLeapYear function to see if it agrees with an alternate method of calculating ' whether years represent "leap years." Dim lngCurYear As Long For lngCurYear = Year(MinDate) To Year(MaxDate) If lngCurYear Mod 500& = 0 Then Debug.Print "#" & lngCurYear End If Dim varFirstDay As Variant varFirstDay = DateSerial(lngCurYear, 1, 1) Dim varEndFeb As Variant varEndFeb = DateSerial(lngCurYear, 2, 29) Dim varFirstMarch As Variant varFirstMarch = DateSerial(lngCurYear, 3, 1) If varEndFeb = varFirstMarch Then If IsLeapYear(varFirstDay) Then Debug.Print varEndFeb & " " & lngCurYear & " " & IsLeapYear(varFirstDay) Stop End If Else '' varEndFeb <> varFirstMarch If Not IsLeapYear(varFirstDay) Then Debug.Print varEndFeb & " " & lngCurYear & " " & IsLeapYear(varFirstDay) Stop End If End If Next lngCurYear End Sub
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.