Programmed pause

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

I have a rather long code that essentially loops through two workbooks and
copies indicated data from one to another. Everything works fine when I use a
break to view the results for each item in the loop, but I get undesirable
results when I remove the break.

How can I program a short pause (about 1 second) prior to "Next" in my loop?

Thanks,

Sam
 
My general comment would be that there is probably another underlying reason
for the error but if you must then try this

Application.Wait Now + TimeValue("00:00:1")

Gives a 1 second pause

Mike
 
I have a rather long code that essentially loops through two workbooks and
copies indicated data from one to another. Everything works fine when I use a
break to view the results for each item in the loop, but I get undesirable
results when I remove the break.

How can I program a short pause (about 1 second) prior to "Next" in my loop?

Thanks,

Sam

Dim PauseTime, StartTime

PauseTime = 1 ' Set duration (seconds)
StartTime = Timer ' Set start time.
Do While Timer < StartTime + PauseTime
'do nothing
Loop

'Continue with code


HTH

Chris
 

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