#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default 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??

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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??



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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??



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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??

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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??




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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??






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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??










  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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??









  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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??









  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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??











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dateadd function Dr. Maunuk Excel Discussion (Misc queries) 2 September 28th 07 07:32 AM
dateadd The BriGuy[_2_] Excel Discussion (Misc queries) 1 March 29th 07 06:51 PM
DateAdd johnboy Excel Programming 2 June 17th 06 10:58 PM
DateAdd Michael Wise[_7_] Excel Programming 1 August 27th 04 07:40 PM
DateAdd function Bill[_19_] Excel Programming 2 November 12th 03 07:07 PM


All times are GMT +1. The time now is 09:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"