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