View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default scheduling dates

On Wed, 19 Oct 2005 15:52:08 -0700, jer wrote:

dear all
I have a worksheet with a comlum of dates
is there a way to increment the dates using code
for example

existing results
column column (e.g. after adding 6 months)

10/15/05 04/15/06
10/15/05 04/15/06
10/16/05 04/16/06

I know I can acheive this with the formula
=DATE(YEAR(A1),MONTH(A1)+6,DAY(A1))
but is there a simple way to do this with code


There is a very similar VBA function:

DateSerial(Year(dt1), Month(dt1) + 6, Day(dt1))

Of course, that has the same limitations as does the worksheet function when it
comes to dealing with end of the month issues.

It may be simpler to use the DateAdd function which takes end of the month
issues into account:

DateAdd("m", 6, dt1)




--ron