VBA & Macro Problems

How to Hide Page Breaks Across Every Worksheet in WPS Office Spreadsheets with VBA

Jason MillerJason Miller Nov 13, 2026 869 views

Question details

The user needs to hide dashed page-break lines on all worksheets in an Excel-compatible workbook at once instead of clearing them one sheet at a time.

How to Hide Page Breaks Across Every Worksheet in WPS Office Spreadsheets with VBA
Product
WPS Office Spreadsheets (Excel-compatible)
Device & OS
not provided
Scenario
After using Print Preview or other print-related actions, Excel 2016 displays page breaks on multiple worksheets in a workbook.
Observed behavior
The normal Hide Page Breaks option must be applied separately to each sheet and may need to be repeated after print-related actions.
Before you start

Open the target workbook in WPS Office Spreadsheets and press Alt+F11 to confirm that the VBA editor opens before you run the macro.

Solution 1Recommended

Run a VBA Macro to Set DisplayPageBreaks to False on All Worksheets

This is the fastest method when the same dashed page-break lines appear on multiple sheets, because it applies the change to every worksheet in the active workbook at once.

The macro uses the ActiveWorkbook.Worksheets collection and sets each worksheet's DisplayPageBreaks property to False. It does not delete manual page breaks or change the print layout.

1
Open the VBA editor

In WPS Office Spreadsheets, open the workbook that contains the visible page breaks and press Alt+F11 to open the VBA editor.

2
Insert a standard module

In the Project Explorer, right-click the workbook project, choose Insert, and then click Module.

3
Paste the macro code

Copy the following macro and paste it into the module window: Sub StopShowingPageBreaks() Dim sh As Worksheet For Each sh In ActiveWorkbook.Worksheets sh.DisplayPageBreaks = False Next sh End Sub

4
Run the macro

Click anywhere inside the Sub StopShowingPageBreaks() code, then press F5 or go to Run > Run Sub/UserForm.

5
Confirm the page breaks are hidden

Return to the workbook and check each worksheet. The dashed page-break lines should no longer be visible in Normal view.

Run a VBA Macro to Set DisplayPageBreaks to False on All Worksheets
Page breaks may reappear: After using Print Preview, Page Layout view, or other print-related actions, page breaks can reappear for the active sheet. Run the macro again to hide them on all worksheets.
WPS Spreadsheets VBA Macro

Hide Page Breaks in Every Worksheet with WPS Office Spreadsheets

Use WPS Office Spreadsheets and its VBA support to run a workbook-level macro that turns off the on-screen page-break display for all worksheets at once. The same macro works in Excel-compatible files, so you can manage page-break clutter without switching tools.

  1. 1. Download and install WPS Office: Go to the official WPS Office download page and install WPS Office on your computer.
  2. 2. Open your Excel workbook: Launch WPS Office Spreadsheets and open the .xlsx or .xlsm file that displays page breaks.
  3. 3. Open the VBA editor: Press Alt+F11 to open the VBA editor and insert a new module.
  4. 4. Paste and run the macro: Paste the StopShowingPageBreaks macro, then press F5 to hide page breaks across all worksheets.
  5. 5. Check worksheets: Return to Normal view and verify that page-break lines are hidden on every worksheet.
Hides page-break lines on all sheets from one macro runFully compatible with Excel .xlsx, .xlsm, and macro-enabled workbooksFree spreadsheet editor with built-in VBA and macro supportFamiliar ribbon interface makes switching from Microsoft Excel easy
microsoft office alternative - wps office

Frequently Asked Questions

Why do page breaks keep reappearing after I hide them?

Page breaks reappear whenever you open Print Preview, Page Layout view, or use other print-related actions for that sheet. The DisplayPageBreaks setting is sheet-level and print actions can turn it back on, so you may need to run the macro again.

Can I hide page breaks on all sheets without a macro?

The built-in Show page breaks option is normally applied per worksheet in Excel and WPS Office Spreadsheets. To update every sheet at once, use the VBA macro that loops through ActiveWorkbook.Worksheets and sets DisplayPageBreaks to False.

Does this VBA macro remove manual page breaks?

No. The macro only hides the automatic dashed page-break lines on screen. It does not delete manual page breaks or change how the workbook prints.

Will this macro work when I open the workbook in WPS Office Spreadsheets?

Yes. WPS Office Spreadsheets supports VBA macros, so you can press Alt+F11, paste the same code into a module, and run it from the VBA editor.