Remove print preview lines (Page Breaks)
Have you ever wondered how these lines got there on a worksheet?
They are called "print preview lines" and they show where pages will break. In other words, they show how much of the worksheet that will be printed on a single paper or pdf.
Why do print preview lines appear?
They show up after you print or after you go to the print dialog box and then press with left mouse button on the "Cancel" button.
They also appear if you press with left mouse button on the Page Break Preview button on the tab "View" on the ribbon and then press with left mouse button on the "Normal" button, however, they don't disappear automatically.
So how do you get rid of the print preview lines?
You can't easily disable them by press with left mouse button oning a button on the ribbon, you have a few options described below.
What are print preview lines for?
They allow you to preview how your spreadsheet will look when printed. They show page breaks - where one printed page ends and the next will begin. They help identify what data will print on each page.
How to adjust preview lines?
- Go to tab "View" on the ribbon.
- Press the "Page Break Preview" button.
The screen changes and thicker blue lines appear. Move these lines to your needs. - Press the "Normal" button to return to the default Excel grid style.
What's on this page
- How to delete print preview lines [Excel 2010-2016]
- How to remove print preview lines using Immediate window
- How to delete print preview lines [Excel 2007]
- How to delete print preview lines [Excel 2003]
- How to delete print preview lines [Mac Excel 2011]
- How to remove Print preview lines programmatically (VBA)
I made a macro, demonstrated later in this article, that you can use to quickly disable the print preview lines, put it in your personal toolbox and use it whenever necessary.
Why use a macro?
You can quickly turn off the "print preview lines" and save a some time.
There is also a macro-enabled workbook for you to get further down in this post. It seems that if you close the workbook and then open it again the print preview lines disappear, however, this is in my opinion to much work to only remove the lines.
1. How to remove dotted lines (Excel Options)
- Press with mouse on tab "File" on the ribbon.
- Press with mouse on "Options"
- Press with mouse on tab "Advanced".
- Scroll down to "Display Options for this worksheet".
- Disable check box next to "Show Page Breaks", see the image above.
- Press with left mouse button on "OK" button to apply changes.
2. How to remove dotted lines (Immediate window)
If you are familiar with the Immediate window in the Visual Basic Editor you can probably more quickly delete the print preview lines than through Excel Options.
- Copy code below.
- Press Alt+F11 to open the VB Editor.
- Paste code to the Immediate window
- Press Enter
- Return to Excel
ActiveSheet.DisplayPageBreaks = False
3. How to remove print preview dotted lines [Excel 2007]
- Press with left mouse button on the Office button located at the top left side of your screen.
- Press with left mouse button on "Excel Options".
- Press with left mouse button on tab "Advanced" in the left window.
- Find "Display Options for this Worksheet".
- Disable the check box "Show Page Breaks"
- Press with left mouse button on "OK" button.
4. How to remove print preview dotted lines [Excel 2003]
- Go to the Tools menu.
- Press with left mouse button on Options.
- Press with left mouse button on the View tab.
- Disable checkbox Page Breaks found in Windows Options.
- Press with left mouse button on OK button.
Excel 2011 Macintosh
- Go to "Preferences" on the menu.
- Press with left mouse button on View in "Authoring".
- Disable checkbox "Show Page Breaks" located below "Windows Options"
5. Build a macro and automate these steps
If you often disable print preview lines manually why not build a macro that does it for you? It is not hard, simply copy the macro and paste it to your workbook module.
If you want to use it any workbook you open, put it in a personal macro workbook and link it to the Quick Access Toolbar or the ribbon.
In fact, you can save useful macros in your personal macro workbook and become a lot more efficient in your work.
5.1 Macro to disable print preview lines
What happens if we record a macro while disabling "Page Breaks" in Excel options? This is what the macro recorder returns:
Macro1() ActiveSheet.DisplayPageBreaks = False End Sub
Use the above line in the examples below if you don't want to toggle print preview lines.
5.2 Macro toggles print preview lines on the active worksheet
Using that code you can now show or hide "Page Breaks" on the active sheet with a macro. Meaning, if "Page Breaks" are visible this macro hides them. If "Page Breaks" are hidden, the macro makes them visible.
Sub Macro1() ActiveSheet.DisplayPageBreaks = Not ActiveSheet.DisplayPageBreaks End Sub
5.3 Macro toggles print preview lines on every sheet in the workbook
The following macro shows or hides "Page Breaks" on every sheet in the current workbook.
Sub Macro2() Dim sh As Worksheet For Each sh In ActiveWorkbook.Worksheets sh.DisplayPageBreaks = Not sh.DisplayPageBreaks Next sh End Sub
5.4 Macro toggles print preview lines on every sheet in all open workbooks
This macro toggles "Page Breaks" on every sheet in every open workbook.
Sub Macro3() Dim wb As Workbook Dim sh As Worksheet For Each wb In Workbooks For Each sh In wb.Worksheets sh.DisplayPageBreaks = Not sh.DisplayPageBreaks Next sh Next wb End Sub
5.5 Watch a video where I explain how to use the macros above
5.6 Where to put the code
- Copy the preferred macro above.
- Go to Visual Basic Editor (VBE). (Alt + F11)
- Press with left mouse button on "Insert" on the menu.
- Insert a new module.
Don't forget to save the workbook as a macro-enabled workbook (*.xlsm file) or the macro is gone the next time you open the workbook.
Here is how to put this macro on the Excel ribbon:
Recommended articles
Save links to your favorite macros in a personal tab on the ribbon for easy access and become more productive. […]
Get
Excel basics category
Table of Contents How to replace part of formula in all cells Substitute multiple text strings - Excel 365 recursive […]
This article demonstrates how to select all blank cells in a given cell range and how to delete them. It […]
How to make your worksheets useful? Making your sheets easy to read is a fundamental approach of creating useful worksheets. […]
Print category
This article describes how to create a button and place it on an Excel worksheet, then assign a macro to […]
This article demonstrates different techniques on how to take a screenshot of your worksheet. You can do that by simply […]
This article describes how to print page numbers in consecutive order through specified worksheets and how to repeat column headers […]
Excel categories
4 Responses to “Remove print preview lines (Page Breaks)”
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form
Thank you! You helped me remove the print preview lines. I'm so grateful!
Olivia,
You are welcome!
First result in google, and is what I needed to know. +1 for SEO, thanks!
thanks so much lol