ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dateadd (https://www.excelbanter.com/excel-programming/386477-dateadd.html)

The BriGuy[_2_]

dateadd
 
In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07. something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??

Brotha Lee

dateadd
 
Try the following
Range("L4").value = dateserial(year(L5),month(L5)+1,day(L5))

HTH
"The BriGuy" wrote:

In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07. something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??


Don Guillett

dateadd
 
Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??




Don Guillett

dateadd
 

tested?

--
Don Guillett
SalesAid Software

"Brotha Lee" wrote in message
...
Try the following
Range("L4").value = dateserial(year(L5),month(L5)+1,day(L5))

HTH
"The BriGuy" wrote:

In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??




The BriGuy[_2_]

dateadd
 
I tried this and got back 1/31/00

"Brotha Lee" wrote:

Try the following
Range("L4").value = dateserial(year(L5),month(L5)+1,day(L5))

HTH
"The BriGuy" wrote:

In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07. something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??


The BriGuy[_2_]

dateadd
 
I tried this and got back 1/31/00

"Brotha Lee" wrote:

Try the following
Range("L4").value = dateserial(year(L5),month(L5)+1,day(L5))

HTH
"The BriGuy" wrote:

In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07. something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??


The BriGuy[_2_]

dateadd
 
This didn't work either. I think because this is being put in the middle of
a larger macro that was expected to end befor I entered Sub again?

"Don Guillett" wrote:

Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??





Don Guillett

dateadd
 
"Didn't work" means nothing without explanation.
I fully tested. Shouldn't make any difference but you didn't post your code,
so???

mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
This didn't work either. I think because this is being put in the middle
of
a larger macro that was expected to end befor I entered Sub again?

"Don Guillett" wrote:

Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??







The BriGuy[_2_]

dateadd
 
Sorry about the lack of clarity. I tried this and it almost did what I
wanted. The date moved from 6/30/06 to 7/30/06 and I tried from 8/31/06 and
it went to 10/01/06. I am looking for it to go to the last day of the month
(ie. 6/30/06 to 7/31/06 and 8/31/06 to 9/30/06).

I appreciate the help on this. Any idea what I can change to get it to work
the way I had hoped?

Thanks

"Don Guillett" wrote:

"Didn't work" means nothing without explanation.
I fully tested. Shouldn't make any difference but you didn't post your code,
so???

mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
This didn't work either. I think because this is being put in the middle
of
a larger macro that was expected to end befor I entered Sub again?

"Don Guillett" wrote:

Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell. L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??







Don Guillett

dateadd
 
Always nice to say what you want the FIRST time.

Sub addmonthtodate() ' NO selections
mc = Range("a1")
Range("i1") = DateSerial(Year(mc), Month(mc) + 2, 1 - 1)
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
Sorry about the lack of clarity. I tried this and it almost did what I
wanted. The date moved from 6/30/06 to 7/30/06 and I tried from 8/31/06
and
it went to 10/01/06. I am looking for it to go to the last day of the
month
(ie. 6/30/06 to 7/31/06 and 8/31/06 to 9/30/06).

I appreciate the help on this. Any idea what I can change to get it to
work
the way I had hoped?

Thanks

"Don Guillett" wrote:

"Didn't work" means nothing without explanation.
I fully tested. Shouldn't make any difference but you didn't post your
code,
so???

mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
This didn't work either. I think because this is being put in the
middle
of
a larger macro that was expected to end befor I entered Sub again?

"Don Guillett" wrote:

Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell.
L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??









The BriGuy[_2_]

dateadd
 
Perfect. I ran it thru 2008 and the info was good.

Thanks for the help


"Don Guillett" wrote:

Always nice to say what you want the FIRST time.

Sub addmonthtodate() ' NO selections
mc = Range("a1")
Range("i1") = DateSerial(Year(mc), Month(mc) + 2, 1 - 1)
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
Sorry about the lack of clarity. I tried this and it almost did what I
wanted. The date moved from 6/30/06 to 7/30/06 and I tried from 8/31/06
and
it went to 10/01/06. I am looking for it to go to the last day of the
month
(ie. 6/30/06 to 7/31/06 and 8/31/06 to 9/30/06).

I appreciate the help on this. Any idea what I can change to get it to
work
the way I had hoped?

Thanks

"Don Guillett" wrote:

"Didn't work" means nothing without explanation.
I fully tested. Shouldn't make any difference but you didn't post your
code,
so???

mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
This didn't work either. I think because this is being put in the
middle
of
a larger macro that was expected to end befor I entered Sub again?

"Don Guillett" wrote:

Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell.
L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??










The BriGuy[_2_]

dateadd
 
Perfect. I ran it thru 2008 and the info was good.

Thanks for the help


"Don Guillett" wrote:

Always nice to say what you want the FIRST time.

Sub addmonthtodate() ' NO selections
mc = Range("a1")
Range("i1") = DateSerial(Year(mc), Month(mc) + 2, 1 - 1)
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
Sorry about the lack of clarity. I tried this and it almost did what I
wanted. The date moved from 6/30/06 to 7/30/06 and I tried from 8/31/06
and
it went to 10/01/06. I am looking for it to go to the last day of the
month
(ie. 6/30/06 to 7/31/06 and 8/31/06 to 9/30/06).

I appreciate the help on this. Any idea what I can change to get it to
work
the way I had hoped?

Thanks

"Don Guillett" wrote:

"Didn't work" means nothing without explanation.
I fully tested. Shouldn't make any difference but you didn't post your
code,
so???

mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
This didn't work either. I think because this is being put in the
middle
of
a larger macro that was expected to end befor I entered Sub again?

"Don Guillett" wrote:

Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell.
L5 =
3/31/07 so when the macro runs I would like L4 to display 4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??










Don Guillett

dateadd
 
Glad to help. In the future, pls try to explain your needs.

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
Perfect. I ran it thru 2008 and the info was good.

Thanks for the help


"Don Guillett" wrote:

Always nice to say what you want the FIRST time.

Sub addmonthtodate() ' NO selections
mc = Range("a1")
Range("i1") = DateSerial(Year(mc), Month(mc) + 2, 1 - 1)
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
Sorry about the lack of clarity. I tried this and it almost did what I
wanted. The date moved from 6/30/06 to 7/30/06 and I tried from
8/31/06
and
it went to 10/01/06. I am looking for it to go to the last day of the
month
(ie. 6/30/06 to 7/31/06 and 8/31/06 to 9/30/06).

I appreciate the help on this. Any idea what I can change to get it to
work
the way I had hoped?

Thanks

"Don Guillett" wrote:

"Didn't work" means nothing without explanation.
I fully tested. Shouldn't make any difference but you didn't post your
code,
so???

mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
This didn't work either. I think because this is being put in the
middle
of
a larger macro that was expected to end befor I entered Sub again?

"Don Guillett" wrote:

Sub addmonthtodate()' NO selections
mc = Range("l5")
Range("l4") = DateSerial(Year(mc), Month(mc) + 1, Day(mc))
End Sub

--
Don Guillett
SalesAid Software

"The BriGuy" wrote in message
...
In a macro I would like to add 1 month to a date in another cell.
L5 =
3/31/07 so when the macro runs I would like L4 to display
4/30/07.
something
like:

Range("L4").Select
ActiveCell. add 1 month to date in L5.

Any ideas??













All times are GMT +1. The time now is 06:15 AM.

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