Force Excel to Refresh Screen

M

Ming

I have a macro which goes through a "for loop" for a large number of
loops and it takes several hours to finish running. I output the number
the run has gone up to in the status bar to show the progress.

Whenever I click away from Excel to another application or when the
screensaver kicks in and I move the mouse again, I get a white screen
in Excel which I can see neither the worksheet nor the status bar. I am
not turning off screen updating in my code.

Does anybody know whether there is a way to get Excel to refresh the
screen (or at least the status bar) during an intensive calculation?
 
A

arno

Hi,

just a few thoughts:

you should turn off screenupdating as this will speed up your code.
From time to time, eg. when the statusbar changes, you can turn on
screenupdating and then immediately turn it off again so that you can
see what is going on. I dont know if this will also solve your problem
when switching back to excel from another application.

arno
 
N

NickHK

As I understand it, it is one thing to allow Excel to update itself with
..ScreenUpdating, but another to allow processing of the message queue from
Windows, as in the Paint message that will be received when Excel is
reshown. Adding a DoEvents at suitable intervals will help with this.

NickHK
 
K

Karim Benabd

Hello,

Try using DoEvents inside your code to instruct Excel to execute other
tasks while running your code.

I hope this helps.

Regards,
Karim
 

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