Skip to Main Content
Excel Hacks
book

Excel Hacks

by David Hawley, Raina Hawley
March 2004
Beginner content levelBeginner
304 pages
7h 2m
English
O'Reilly Media, Inc.
Content preview from Excel Hacks

Chapter 7. Macro Hacks

Hacks #81-94

Macros make it wonderfully easy to automate repetitive tasks in Excel, but the way they’re created and the facilities for using them are sometimes problematic. Fortunately, Excel is flexible enough that you can fix those problems and create new features with a minimum of effort.

Speed Up Code While Halting Screen Flicker

When you record macros from within Excel, the code it generates often produces screen flicker, which not only slows down your macro, but also makes the macro’s activity look very disorganized. Fortunately, you can eliminate screen flicker while at the same time speeding up your code.

One drawback with recorded macros in Excel is that the code produced is often very inefficient. This can mean macros that should take a matter of seconds to complete often take a lot longer and look very unsightly. Also, when you write macros using the macro recorder, all keystrokes are recorded, whether they are meant to be or not. This means that if you make an error and then correct it, the keystrokes required to complete those actions also will be recorded in your macro code.

If you have played around a bit with macros or dabbled in VBA code, you might have heard of the Application.ScreenUpdating property. By setting ScreenUpdating to False at the start of a macro, you will not only stop the constant screen flicker associated with a recorded macro, but also speed up the macro’s execution. The reason this method speeds up code is because ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel Hacks, 2nd Edition

Excel Hacks, 2nd Edition

David Hawley, Raina Hawley
101 Ready-To-Use Excel Macros

101 Ready-To-Use Excel Macros

Michael Alexander, John Walkenbach
Excel Annoyances

Excel Annoyances

Curtis D. Frye

Publisher Resources

ISBN: 059600625XErrata Page