Macro to change date cell by specified interval

A

Adam

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.
 
J

Joel

Range("A1") = Range("A1") + TimeSerial(0, 10, 0)

timeserial parameters are hours, minutes, seconds
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top