Time Delay

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
 
B

Bob Phillips

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)
 
D

David Adamson

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
 
K

Kilcup

Thanks for the help... simple answer, but it does the trick. Have
great day.

Jef
 
Top