VBA Display Page Breaks / Page Break Preview

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on March 16, 2024

One way to speed up your VBA code is to disable displaying page breaks by changing the DisplayPageBreaks. Changing this setting won’t always have an impact. It should only matter if (From Microsoft):

  • You’ve previously set a PageSetup property for the relevant worksheet and your VBA procedure modifies the properties of many rows or columns
  • OR Your VBA procedure forces Excel to calculate pagebreaks (displaying Print Preview or modifying any properties of PageSetup).

To disable displaying page breaks set the DisplayPageBreaks property to false:

ActiveSheet.DisplayPageBreaks = False

You can turn DisplayPageBreaks back on by setting the property to true:

ActiveSheet.DisplayPageBreaks = True

Note that the DisplayPageBreaks setting must be set for each individual worksheet. To disable displaying page breaks for all worksheets in a workbook:

Sub DisplayPageBreaks_Example()

    Dim ws As Worksheet
    For Each ws In Worksheets
        ws.DisplayPageBreaks = False
    Next ws
    
End Sub

Page Break Preview Mode

To place Sheet1 in Page Break Preview View

Sheet1.Activate
ActiveWindow.View = xlPageBreakPreview

Restore Normal View Mode

To place Sheet1 in in Normal View:

Sheet1.Activate
ActiveWindow.View = xlNormalView

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as


Learn More!
vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples