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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top