Time Delay

  • Thread starter Thread starter Kilcup
  • Start date Start date
K

Kilcup

To All,

I have a vba code that seems to be going too fast for its' own good.
When I "Step Into" the code and watch each step slowly, everything
works fine, but when I play the macro it deletes more information that
shouldn't be deleted.

Is there a way to pause the code, say for a few seconds, so that the
computer could "catch up" with itself and not jumble the code?

I know of other code-based programs that do this, and I thought excel
may be able to also.

Thanks much!
Jeff
 
Look at Wait in help.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
The following will give .5 sec delay

put the follwoing at the top of the module
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


'put this where you want the code to pause
sleep 500


But by all rights this wouldn't fix up your problem. It sounds as though
you have got the code looping through more events than you originaly
planned.
I would double check the code. by putting a msgbox near your loop to
doublecheck
 
Thanks for the help... simple answer, but it does the trick. Have
great day.

Jef
 

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