View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Last Day of the month

Dim myDate As Date
Dim myLastDay As Long
Dim myLastDate As Date

myDate = DateSerial(2009, 2, 1) 'or Date

myLastDay = Day(DateSerial(Year(myDate), Month(myDate) + 1, 0))
myLastDate = DateSerial(Year(myDate), Month(myDate) + 1, 0)
MsgBox myLastDay & vbLf & myLastDate

===
I'm not sure if you wanted to see 28 or Feb 28, 2009.





JT wrote:

I have a date in a cell and want to find out what the last day for the month
is. Is there an easy way to do this with VB and just include it with the
rest of the code?

Thanks for the help
--
JT


--

Dave Peterson