View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default can you add months to a date?

Just so you understand what smartin was trying to tell you, try the code
FSt1 gave you with a date of January 31st and add one month to it... is that
the date you expected?

--
Rick (MVP - Excel)


"greg" wrote in message
...
cool thanks

"FSt1" wrote in message
...
hi
something like this might work for you'
assuming you have a date value in a cell......
Sub dateadd()
Dim d As Date
d = Range("I3").Value
d = DateSerial(Year(d), Month(d) + 6, Day(d))
MsgBox d
End Sub

regards
FSt1

"greg" wrote:

can you add months to a date?
So for example you have a date. any date. like 5/20/2010
Then I want to add 6 months to the date. Then get 11/20/2010
Is there a way to do this in vba/excel?

thanks