Here are the rules for determining if a year is a leap year...
http://www.timeanddate.com/date/leapyear.html
1. Every year divisible by 4 is a leap year.
2. But every year divisible by 100 is NOT a leap year
3. Unless the year is also divisible by 400, then it is still a leap
year.
Someone had a similar question awhile back.
The solution is basically a series of If...Thens based on the rules above.
function isLeapYear(year)
isLeapYear = false
if somefunction(year/4) = 0 then isLeapYear = true
if somefunction(year/100) = 0 then isLeapYear = false
if somefunction(year/100) = 0 AND somefunction(year/400) then
isLeapYear = true
end function
someFunction() is the function that I can never remember which returns
the decimal portion of a value. Still a bit asleep. But basically that
will do it. I personally don't the somewhat simpler method of checking
for 29 years in February since I've got a Business Analyst background
and prefer to have my functions based on defined requirements. Since
isLeapYear() is based on the rules, it will always work whereas the
others are assuming that the underlying codeing behind VBA is correct.