breakpoint affecting the run speed of a macro

K

kebabb

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!
 
J

Jim Cone

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"
<[email protected]>
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!
 
G

Gary Keramidas

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.
 

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

Top