PDA

View Full Version : Stop my Excel screen from jumping around


PK
11-15-2002, 10:06 AM
I have a simple macro (visual basic) in Excel that needs to move from cell to cell, usually with something like this:

ActiveCell.Offset(0, 1).Select

Often, the move is between tabs or to cells that are off the screen. I know that there is a command I can put in my code that will stop all this from being displayed while it happens.

What is that command? Essentially, I want the macro to start with

Don't display anything while you jump around and set up all the data.

and then end with
OK, you can go back to a normal display mode.

Thanks in advance.

MathGuy
11-15-2002, 10:54 AM
Application.ScreenUpdating = False, etc.

whisper
11-15-2002, 10:57 AM
Add this to the beginning of your code:

Application.ScreenUpdating = False

and this to the end of your code:

Application.ScreenUpdating = True

PK
11-15-2002, 01:29 PM
Thanks! Works like a charm. The initialization used to be 3 or 4 seconds of the screen jumping around. It is now virtually instantaneous and your eyes don't get buggy.

Brad Gile
11-15-2002, 05:37 PM
The Application.ScreenUpdating property is one of the best tricks in VBA, and can REALLY speed things up. If you want to get cute (AND a tad risky), try this:

Application.ScreenUpdating=False
Application.Visible=False

'Do whatever

Application.ScreenUpdating=True
Application.Visible=True

You can't SEE Excel while it runs! Startle your user! If something goes wrong though, you'll need to use the Task Manager to kill the process.

Brad

Moderator2
11-15-2002, 05:59 PM
Startle your user!
Brad

uhhh, :yikes: