Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Automatic increment of onTime

Hi,
Please will someone tell me (if possible) how to automatically increment the
times in the following example. I have got 370 times to enter in one minute
increments.

Sub StartTime()
Application.OnTime TimeValue("17:28:00"), "CopyVolume1"
Application.OnTime TimeValue("17:29:00"), "CopyVolume2"
Application.OnTime TimeValue("17:30:00"), "CopyVolume3"
End Sub

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Automatic increment of onTime

Hi Rob,

I have assumed that your start time is 17:28:00 so I have changed the
minutes to 27 to allow the first iteration to add 1 to become 28.

Also note that a space and underscore at the end of a line is a line break
in an other wise single line of code.

Dim i As Long

For i = 1 To 370
Application.OnTime _
TimeValue("17:" & 27 + i & ":00"), _
"CopyVolume" & i
Next i

--
Regards,

OssieMac


"Rob" wrote:

Hi,
Please will someone tell me (if possible) how to automatically increment the
times in the following example. I have got 370 times to enter in one minute
increments.

Sub StartTime()
Application.OnTime TimeValue("17:28:00"), "CopyVolume1"
Application.OnTime TimeValue("17:29:00"), "CopyVolume2"
Application.OnTime TimeValue("17:30:00"), "CopyVolume3"
End Sub

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Automatic increment of onTime

Hi again Rob,

Disregard that answer; it won't work after 59 mins. I will have another look
at it.

--
Regards,

OssieMac


"Rob" wrote:

Hi,
Please will someone tell me (if possible) how to automatically increment the
times in the following example. I have got 370 times to enter in one minute
increments.

Sub StartTime()
Application.OnTime TimeValue("17:28:00"), "CopyVolume1"
Application.OnTime TimeValue("17:29:00"), "CopyVolume2"
Application.OnTime TimeValue("17:30:00"), "CopyVolume3"
End Sub

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Automatic increment of onTime

Hi yet again Rob,

My apologies for the previous version. Was not thinking clearly. The
following method of including the date should handle going past midnight
also. However, the code is untested in conjunction with the OnTime function.
Start time can be real first time because not incremented until after first
iteration.

Sub test()

Dim i As Long
Dim timeStart As Date
Dim timeIncrement As Date

timeStart = Date + TimeValue("17:28:00")
timeIncrement = TimeValue("00:01:00")

For i = 1 To 370
Application.OnTime timeStart, "CopyVolume" & i
timeStart = timeStart + timeIncrement
Next i

End Sub

--
Regards,

OssieMac


  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Automatic increment of onTime

Thanks OssieMac.

"OssieMac" wrote:

Hi yet again Rob,

My apologies for the previous version. Was not thinking clearly. The
following method of including the date should handle going past midnight
also. However, the code is untested in conjunction with the OnTime function.
Start time can be real first time because not incremented until after first
iteration.

Sub test()

Dim i As Long
Dim timeStart As Date
Dim timeIncrement As Date

timeStart = Date + TimeValue("17:28:00")
timeIncrement = TimeValue("00:01:00")

For i = 1 To 370
Application.OnTime timeStart, "CopyVolume" & i
timeStart = timeStart + timeIncrement
Next i

End Sub

--
Regards,

OssieMac


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
Find %ontime & SUMIF ontime ie: find matching sets within Range... Chris T-M Excel Worksheet Functions 3 October 10th 08 08:14 PM
stop automatic increment of dates Susan C. Excel Discussion (Misc queries) 2 September 21st 05 05:57 PM
Automatic cell increment with data from sheet 1 to sheet 2 Big G Excel Worksheet Functions 2 December 20th 04 05:59 PM
How do I input for an automatic increment in a cell on Excel? Rissy Excel Worksheet Functions 1 November 29th 04 09:01 AM
automatic counter or auto-increment Jjt Excel Programming 1 January 16th 04 07:56 PM


All times are GMT +1. The time now is 03:31 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"