View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Determine if it's a leap year

Building on Bob's suggestion would be to determine the last day in February
(the zeroeth day in March)

in VBA
lyear = 2007
for i = 1 to day(dateSerial(lyear,3,0))

to demonstrate from the immediate window:

? day(dateserial(2008,3,0))
29


--
Regards,
Tom Ogilvy


"Bob Phillips" wrote in message
...
Jan,

Here is one way, assuming your date is in A1

=IF(MONTH(DATE(YEAR(A1),2,29))=2,"Leap Year","Not a Leap Year")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jan" wrote in message
...
Hi all,
I need a piece of vba code to determine if it's a leap year.
Then I can add 29 days for the month of february.

Kind regards

Jan