Macro runs faster when VB code window open

G

Gerardo

I have a macro that runs quite fast when the Visual Basic code window is
open. But if it is closed takes a few minutes.

The macro reads one sheet and writes a in a second one when new data is
found for the report, I know is faster to read all data, fill up an array and
then write it all at once.

Any ideas?
 
P

Per Jessen

Hi

Start your macro with this line:

Application.ScreenUpdating=False

And this line before "End Sub"

Application.ScreenUpdating = True

If you need further advise, show us your code!

Regards,
Per
 
G

Gerardo

Thank you, I do have that code, but I don´t know why is different when the
code window is open.

I'm sorry, this macro is quite large to show and now with some more
experience I actually will do it differently, since i read that the problem
might be going back and forth between worksheets. I just don't want to star
over.
 

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