ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro runs faster when VB code window open (https://www.excelbanter.com/excel-programming/413236-macro-runs-faster-when-vbulletin-code-window-open.html)

Gerardo

Macro runs faster when VB code window open
 
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?

Per Jessen

Macro runs faster when VB code window open
 
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
"Gerardo" skrev i meddelelsen
...
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?



Gerardo

Macro runs faster when VB code window open
 
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.

"Per Jessen" wrote:

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
"Gerardo" skrev i meddelelsen
...
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?





All times are GMT +1. The time now is 07:27 PM.

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