Hei.
How to calculate how many days is in the year. 365 or 366 ?!
Hei.
How to calculate how many days is in the year. 365 or 366 ?!
[VBA]
Private Function GiveNumDaysInYear(Year As Long) As Integer
GiveNumDaysInYear = IIf(Year Mod 4, 365, 366)
End Function
[/VBA]
Hi Cass,
Tommy's solution isn't quite complete as it doesn't cater for 'century years'. This should give the right answer for all years[vba]Function DaysInYear(Year As Long) As Long
DaysInYear = 365 - (Year Mod 4 = 0) + (Year Mod 100 = 0) - (Year Mod 400 = 0)
End Function[/vba]
Enjoy,
Tony
---------------------------------------------------------------
Give a man a fish and he'll eat for a day.
Teach him how to fish and he'll sit in a boat and drink beer all day.
I'm (slowly) building my own site: www.WordArticles.com