This Microsoft Excel tutorial shall help you learn how to remove page breaks in Excel.
In Excel, a page break controls the amount of data that gets printed on each page. When the data exceeds the capacity of a single page, Excel automatically inserts a page break to accommodate it. Additionally, you can manually insert page breaks either horizontally, vertically, or both.
If you’re looking to adjust the printed content by either replacing existing page breaks or removing them altogether, this article will guide you through the process. However, you can’t remove the automatic page breaks. Stay tuned to discover simple methods to delete page breaks effortlessly.
Remove Page Breaks From the Normal View
The thin black borders across columns and rows are the manual page breaks of your worksheet.
If you wish to selectively delete a few page breaks, navigate to the source worksheet.
To remove a vertical page break, select any cell to the immediate right of the page break you wish to remove.
Now, press Alt + P + B + R to remove the page break.
To delete a horizontal page break, click on any cell immediately below the page break you want to remove.
Press the same keyboard shortcut to get rid of the horizontal page break.
📒 Read More: 8 Ways To Insert Page Break in Microsoft Excel
Remove Page Breaks From Page Break Preview
Go to the worksheet from which you must remove a few page breaks.
Press Alt + W + I to access the Page Break Preview mode. In this mode, you shall see all the manual (thick blue lines) and automatic (dashed blue lines) page breaks of the worksheet.
Now, you can follow the steps mentioned in the previous section to delete the page break you don’t want in the worksheet.
This is how your worksheet looks in the Page Break Preview mode when you remove specific manual page breaks using shortcuts.
Remove Page Breaks Using a Right-Click
You can also remove page breaks from an Excel worksheet using the Remove Page Break command from the right-click context menu.
However, you can only use this method when you’re in the Page Break Preview mode.
Navigate to the worksheet from which you want to delete the page breaks.
Select any cell to the immediate right of a vertical page break and right-click.
In the context menu, click on the Remove Page Break command.
Highlight any cell immediately below a horizontal page break.
Click on the Remove Page Break command in the right-click content menu.
Remove Page Breaks Using Drag and Drop
This method also works only in the Page Break Preview mode.
Use the method mentioned previously to access the Page Break Preview.
Now, click on a vertical page break you wish to remove and drag to the left or right edge of the worksheet.
If there’s only one page break between the left or right edge, you only remove the selected page break.
However, if there’s another page break between the one you’re dragging and the edge of the worksheet, you remove both page breaks.
Similarly, select the horizontal page break you’re removing and drag it to the left or right edge to remove it.
If there are any page breaks in between, Excel shall also remove those.
Remove All Manual Page Breaks Instantly
You can instantly remove all the manual page breaks from the worksheet in one click using the Reset All Page Break command. You can access this command from the Page Layout > Breaks in both Normal and Page Break Preview mode.
If you’re in the Page Break Preview mode, you can also right-click and find the Reset All Page Break option in the context menu.
So, go to the source worksheet and press Alt + P + B + A to remove all the page breaks that you’ve added manually.
Hide Page Breaks Using Excel Options
Suppose, you wanted to remove page breaks in your worksheet just because they’re distracting your workflow in the Normal view. The page breaks show up as thin black lines spanning entire row or column borders where added. This might often confuse you if you’re working with tables or normal datasets with thin cell borders.
If you delete these page breaks, it might be challenging for you to insert these in the same place the next time.
In this scenario, you can use the Excel Options tool to hide page break indicators in the Normal worksheet view.
To try this out, go to the source worksheet and press Alt + F + T to bring up the Excel Options dialog box.
Click on the Advanced category in the left-side navigation panel.
On the right, scroll down until you find the Display options for this worksheet heading. Uncheck the Show page breaks checkbox below this section.
Excel shall remove all the page break indicators for all worksheets in the workbook.
To manually enable the page break view for other worksheets, click the worksheet drop-down to choose a different one. Then, checkmark the Show page breaks checkbox.
Remove Page Breaks Using Excel VBA
If you don’t want to go through all the manual processes to remove page breaks, you can try out this method. Here, you’ll be using various VBA scripts to programmatically delete page breaks in a few clicks. Also, you don’t need to remember any steps. Simply, run the VBA macro tied to any of these VBA scripts.
Use this VBA script to get rid of all the manual page breaks from the active worksheet:
Sub RemovePageBreaks()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.ResetAllPageBreaks
End Sub
You can read the following Excel tutorial to find the steps to create a VBA macro using the above-mentioned script.
📒 Read More: How To Use The VBA Code You Find Online
To run the macro, you only need to press Alt + F8, select the RemovePageBreaks macro in the Macro dialog box, and click on the Run button.
Find below another VBA script that’ll let you selectively remove horizontal page breaks in the active worksheet.
Sub RemovePageBreaks()
Dim ws As Worksheet
Dim pb As Variant
Dim rng As Range
Dim inputStr As String
Dim locations() As String
Dim i As Integer
' Set the active worksheet
Set ws = ActiveSheet
' Get the input from the user
inputStr = InputBox("Enter the page break locations (row numbers) you want to delete, separated by commas:")
' Split the input string into an array
locations = Split(inputStr, ",")
' Loop through the array and remove the page breaks
For i = LBound(locations) To UBound(locations)
' Set the range where the page break is located
Set rng = ws.Rows(CInt(locations(i)))
' Check if there is a page break in the range
If rng.PageBreak <> xlPageBreakNone Then
' Remove the page break
rng.PageBreak = xlPageBreakNone
End If
Next i
' Inform the user
MsgBox "Page breaks removed successfully!", vbInformation
End Sub
After you run the script, Excel shall show an input box.
Enter the location of the page breaks into the prompt. Separate the locations by commas to help Excel learn which page breaks to remove.
For example, if the page break is between rows 7
and 8
, you must enter 8
in the prompt.
The VBA script assumes that the page break line is on the top border of the selected row.
Here’s another VBA script that lets you delete only vertical page breaks.
Sub RemoveVerticalPageBreaks()
Dim ws As Worksheet
Dim pb As Variant
Dim rng As Range
Dim inputStr As String
Dim locations() As String
Dim i As Integer
' Set the active worksheet
Set ws = ActiveSheet
' Get the input from the user
inputStr = InputBox("Enter the column numbers of the page breaks you want to delete, separated by commas:")
' Split the input string into an array
locations = Split(inputStr, ",")
' Loop through the array and remove the page breaks
For i = LBound(locations) To UBound(locations)
' Set the range where the page break is located
Set rng = ws.Columns(CInt(locations(i)))
' Check if there is a page break in the range
If rng.PageBreak <> xlPageBreakNone Then
' Remove the page break
rng.PageBreak = xlPageBreakNone
End If
Next i
' Inform the user
MsgBox "Page breaks removed successfully!", vbInformation
End Sub
In the prompt box that shows up, enter the column number where the page break appears.
You can’t enter the alphabetical characters of the column. For example, you must enter 1
for column A, 2
for column B, and so on.
Excel assumes that the page break is available at the left-side border of the selected column.
⚠️ Warning: Create a backup copy of the workbook before running the VBA scripts mentioned above. You won’t be able to revert back to the previous setting using the Excel undo feature.
Conclusions
The Excel skill of removing page breaks comes in handy when you want to reset the per-page printing volume of the dataset from the source worksheet.
You can use the methods mentioned above, like using shortcut keys, right-clicking in Page Break Preview, and dragging a page break to the edge of the worksheet to manually remove page breaks.
However, if your worksheet contains many page breaks spanning hundreds of columns and thousands of rows, you can use the programmatic method based on Excel VBA.
Above, I’ve described three different VBA scripts that remove all, only vertical, and only horizontal page breaks in the active worksheet.
If the article helped you by introducing some awesome ways to delete page breaks, share your comments below. If you know a better method, kindly name it in your comment.
0 Comments