scheduling dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Thanks Ron
--
thanks as always for the help
jer

Ron Rosenfeld said:
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
 

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

Back
Top