View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Curt Curt is offline
external usenet poster
 
Posts: 469
Default Last Day of the month

You are close to my problem. What I am trying to do is if (Day Is 15) do this
I do not care what month or year are only the day. If day=15 b3=19.96
Looking thru and seen your entry so decided to throw out my problem
Thanks

"Gary''s Student" wrote:

Say the date is in cell A1. In another cell enter:

=DATE(YEAR(A1),MONTH(A1)+1,0)


To do the same thing with VBA:

Sub lastday()
Dim d As Date
d = Evaluate("DATE(YEAR(A1),MONTH(A1)+1,0)")
MsgBox (d)
End Sub

--
Gary''s Student - gsnu200830


"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