Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Working with Excel Objects > Controlling Excel's Screen Updating Beh...

Controlling Excel's Screen Updating Behavior

When your code is performing a set of changes to a workbook, you may want to set the ScreenUpdating property to false to prevent Excel from updating the screen while your code runs. Setting it back to true will refresh the screen and allow Excel to continue updating the screen.

Beyond the cosmetic benefit of not forcing the user to watch Excel change cells while your code runs, the ScreenUpdating property proves very useful for speeding up your code. Repainting the screen after each operation can be quite costly. Be sure to set this property back to true when your code is finished—otherwise, the user will be left with an Excel that does not paint. As you will see below, a try-finally block is a handy way to ensure that the property is reset even if an exception is thrown.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint