How to find out the last day of month?

H

hanski

Hi

I need to know via VBA what is the last day of every month? Of course I
know in January the last day is 31 and so on, but every fourth year
February is either 28 or 29 and I do not want do it manually. So I
think there is some kind of function, which find out the last day of
month?


Hannu
 
T

Tom Lake

hanski said:
Hi

I need to know via VBA what is the last day of every month? Of course I
know in January the last day is 31 and so on, but every fourth year
February is either 28 or 29 and I do not want do it manually. So I
think there is some kind of function, which find out the last day of
month?

This will do it:

LastDayOfMonth = DateSerial(Year(Date), Month(Date) + 1, 0)

Tom Lake
 
Top