ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Time Delay (https://www.excelbanter.com/excel-programming/303058-time-delay.html)

Kilcup[_9_]

Time Delay
 
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


---
Message posted from http://www.ExcelForum.com/


Bob Phillips[_6_]

Time Delay
 
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)

"Kilcup " wrote in message
...
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


---
Message posted from http://www.ExcelForum.com/




David Adamson[_3_]

Time Delay
 
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



"Kilcup " wrote in message
...
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


---
Message posted from http://www.ExcelForum.com/




Kilcup[_10_]

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

Jef

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 04:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com