ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   scheduling dates (https://www.excelbanter.com/excel-programming/343301-scheduling-dates.html)

jer

scheduling dates
 
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

--
thanks as always for the help
jer

Ron Rosenfeld

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

jer

scheduling dates
 
Thanks Ron
--
thanks as always for the help
jer

"Ron Rosenfeld" wrote:

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


Ron Rosenfeld

scheduling dates
 
On Thu, 20 Oct 2005 08:39:04 -0700, jer wrote:

Thanks Ron
--
thanks as always for the help
jer


You're welcome. Glad to help.
--ron


All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com