Need help with the following code snippet:

bbot23

New Member
Joined
Oct 29, 2010
Messages
37
Code:
Sub checknewentries()

If Workbooks("trend_strat").Worksheets("trend10").Range("AI1").Value < Workbooks("trend_strat").Worksheets("trend10").Range("AI2").Value Then


Workbooks("trend_strat").Worksheets("recordings").Range("E2:WF100").Value = Workbooks("trend_strat").Worksheets("recordings").Range("D2:WE100").Value
Workbooks("trend_strat").Worksheets("recordings").Range("WG2:WG100").Cells.Clear

Dim i As Integer
For i = 0 To 40

If Workbooks("trend_strat").Worksheets("trend10").Range("Z2").Offset(i, 0).Value > 0 Then
    Call SendOrder(i+2)

End If

Next

ActiveWorkbook.Save

Workbooks("trend_strat").Worksheets("trend10").Range("AI1").Value = Workbooks("trend_strat").Worksheets("trend10").Range("AI1").Value + 1
    alertTime = Now + TimeValue("00:00:03")
    Application.OnTime alertTime, "checknewentries"

End If

End Sub

Right now the code simply copies a set of values every 3 seconds over to the next column, and it also checks every 3 seconds if a cell is bigger than 0 so that it can Call another macro named Sendorder.

The above code works fine, but I'm wondering if it's possible to do the "Call SendOrder" part on a different period (other than 3 seconds). I actually need excel to immediately Call SendOrder when the celll value that it is looking at is above zero, not to check for it potentially 3 seconds later. Would it be wise to make excel keep scanning for the cell value change every, say, half a second? if so, how do I incorporate two different loops? Is there another way of doing what I need?

Thanks!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,521
Messages
6,179,275
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top