ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   breakpoint affecting the run speed of a macro (https://www.excelbanter.com/excel-programming/378538-breakpoint-affecting-run-speed-macro.html)

kebabb

breakpoint affecting the run speed of a macro
 
Hi,

I have a macro that seems to be running slowly when left to its own
devices. I did some testing to figure out which particular part of the
macro was being slow (a part that loops through an array and writes
data to a worksheet). If I put a breakpoint immediately before the slow
part then hit F5 to continue execution, it runs much faster (2 secs
versus 30 secs without the breakpoint). This makes no sense to me. Can
someone please explain what precisely is happening here?

Thanks!


JLGWhiz

breakpoint affecting the run speed of a macro
 
Probably got its second wind.

"kebabb" wrote:

Hi,

I have a macro that seems to be running slowly when left to its own
devices. I did some testing to figure out which particular part of the
macro was being slow (a part that loops through an array and writes
data to a worksheet). If I put a breakpoint immediately before the slow
part then hit F5 to continue execution, it runs much faster (2 secs
versus 30 secs without the breakpoint). This makes no sense to me. Can
someone please explain what precisely is happening here?

Thanks!



Jim Cone

breakpoint affecting the run speed of a macro
 
Just a guess... try adding "DoEvents" (no quote marks) on its own
line at the place where you had entered the break point.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"kebabb"

wrote in message
Hi,
I have a macro that seems to be running slowly when left to its own
devices. I did some testing to figure out which particular part of the
macro was being slow (a part that loops through an array and writes
data to a worksheet). If I put a breakpoint immediately before the slow
part then hit F5 to continue execution, it runs much faster (2 secs
versus 30 secs without the breakpoint). This makes no sense to me. Can
someone please explain what precisely is happening here?
Thanks!


Gary Keramidas

breakpoint affecting the run speed of a macro
 
i seen significant speed differences when running code after opening the vbe.
even if i close it, code runs slower. but if i quit , restart excel and then run
the code, it is fast again. open and close the code editor, it slows down.

--

Gary

"kebabb" wrote in message
ps.com...
Hi,

I have a macro that seems to be running slowly when left to its own
devices. I did some testing to figure out which particular part of the
macro was being slow (a part that loops through an array and writes
data to a worksheet). If I put a breakpoint immediately before the slow
part then hit F5 to continue execution, it runs much faster (2 secs
versus 30 secs without the breakpoint). This makes no sense to me. Can
someone please explain what precisely is happening here?

Thanks!





All times are GMT +1. The time now is 08:48 PM.

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