Return to VBA Code Examples

VBA Display Page Breaks Setting

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

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!