Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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?? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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?? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dateadd function | Excel Discussion (Misc queries) | |||
dateadd | Excel Discussion (Misc queries) | |||
DateAdd | Excel Programming | |||
DateAdd | Excel Programming | |||
DateAdd function | Excel Programming |