Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to change date cell by specified interval
I would like to create a macro in Excel that when executed adds or subtracts
a user specified interval of time in minutes. I would like two cells: one with the date and the other with the interval, for example 10 minutes. When the user executes the macro, I would like to see the date cell update. So if the date cell was 2/12/08 1:00PM, the interval cell was 10 and you executed the macro, the date cell updates to 2/12/08 1:10PM. Then if the macro is executed again it would add another 10 minutes to and make the date 2/12/08 1:20PM. How would I go about achieving this. I have tried the DateAdd function, but it only works for one execution. I want it to update and add another 10 for the next execution. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to change date cell by specified interval
Range("A1") = Range("A1") + TimeSerial(0, 10, 0)
timeserial parameters are hours, minutes, seconds "Adam" wrote: I would like to create a macro in Excel that when executed adds or subtracts a user specified interval of time in minutes. I would like two cells: one with the date and the other with the interval, for example 10 minutes. When the user executes the macro, I would like to see the date cell update. So if the date cell was 2/12/08 1:00PM, the interval cell was 10 and you executed the macro, the date cell updates to 2/12/08 1:10PM. Then if the macro is executed again it would add another 10 minutes to and make the date 2/12/08 1:20PM. How would I go about achieving this. I have tried the DateAdd function, but it only works for one execution. I want it to update and add another 10 for the next execution. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum.if date is in an interval... | Excel Worksheet Functions | |||
Add value if date is in an interval... tricky?! | Excel Programming | |||
A macro that can delete the contents of a cell after a delayed interval | Excel Programming | |||
lookup date in the interval | Excel Programming | |||
Run a macro with date/cell change | Excel Programming |