induce sleeping time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i want to have this macro sleeping 2s (during that time PXLAST will hopefully
get updated via DDE) until the condition is verified, can you help me out?
thanks in advance


Sub Macro1()

Dim i As Integer

For i = 1 To 1000
Do While Worksheets("sheet1").Range("pxlast").Value =
Worksheets("sheet1").Range("init").Offset(i - 1, 0).Value

Sleep 2000 / this wont work

Loop
Worksheets("sheet1").Range("pxlast").Copy
Worksheets("sheet1").Range("init").Offset(i, 0).PasteSpecial
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Next

End Sub
 
Hi,

Put this couple of lines of code where you want to pause:-

Sub delayingtactics()
PauseTime = 2 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
Loop
Finish = Timer
End Sub

Mike
 
that wont work i'll tell you why. I absolutely must have my macro sleeping
because if the macro is running, then the DDE links are not updated.
 

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

Back
Top