Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
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
Sum.if date is in an interval... Mikael Lindqvist Excel Worksheet Functions 6 November 13th 07 10:06 AM
Add value if date is in an interval... tricky?! Mikael Lindqvist Excel Programming 1 November 11th 07 11:41 PM
A macro that can delete the contents of a cell after a delayed interval [email protected] Excel Programming 5 January 20th 07 06:59 AM
lookup date in the interval Greg Excel Programming 4 November 20th 06 12:51 PM
Run a macro with date/cell change Darren Excel Programming 0 February 10th 06 10:05 AM


All times are GMT +1. The time now is 04:11 AM.

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"