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 How to Loop?

Hi,
With reference to the code below. I would like to loop this code at specific
one minute time intervals two cells to the right. The idea is to have the
loop running from 10am to 4pm. Assuming for example that cell i6 is the
active cell at 10am and then at 10:01am k6 becomes the active cell.

Sub CheckVolumeRise2()
If Range("i6") < Range("k6") And Range("k6") < Range("m6") Then
CriteriaReached.Show
End If
End Sub

So at 10:01am the routine would be checking k6 < m6 <o6.

Please will someone show me how to implement this.

Thank you.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default How to Loop?

Private nTime As Double

Public Sub StartJob()

nTime = TimeValue("10:00:00")
Application.OnTime nTime, "CheckVolumeRise2"
End Sub

Public Sub CheckVolumeRise2()
Static rng As Range

If rng Is Nothing Then Set rng = Range("I6")

If rng.Value < rng.Offset(0, 2).Value And _
rng.Offset(0, 2).Value < rng.Offset(0, 4).Value Then

CriteriaReached.Show
End If

If Now < TimeValue("16:00:00") Then

nTime = nTime + TimeValue("00:01:00")
Application.OnTime nTime, "CheckVolumeRise2"
End If
End Sub

--

HTH

Bob

"Rob" wrote in message
...
Hi,
With reference to the code below. I would like to loop this code at
specific
one minute time intervals two cells to the right. The idea is to have the
loop running from 10am to 4pm. Assuming for example that cell i6 is the
active cell at 10am and then at 10:01am k6 becomes the active cell.

Sub CheckVolumeRise2()
If Range("i6") < Range("k6") And Range("k6") < Range("m6") Then
CriteriaReached.Show
End If
End Sub

So at 10:01am the routine would be checking k6 < m6 <o6.

Please will someone show me how to implement this.

Thank you.



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
returning back to loop check condition without completing the loop ashish128 Excel Programming 13 April 3rd 08 12:53 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 0 March 27th 07 11:17 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


All times are GMT +1. The time now is 05:33 PM.

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"