Excel macro slows down on second run

L

lee777

Hi. I am facing a problem with the performance of a macro that my
colleague has written. In a nutshell, the macro vlookups for values
from various excel workbooks/wooksheets, and put them all into one
worksheet (wsSample). The first time it runs, the speed of the macro
is "acceptable". After the existing the macro (VBA....passes END),
while Excel is still running and the wsSample is still active, if I try
to rerun the macro, the speed of the macro drops drastically. However,
this problem will not occur if I shut down Excel, restart Excel and
rerun the macro. Does anybody know anything about this?
 
T

Tom Ogilvy

Does the sheet display pagebreaks after running the macro - if so, this may
be the source of the problem.

At the top of the macro put

ActiveSheet.DisplayPageBreaks = False
 

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