Change the Print Area on Multiple Excel Worksheets
Question details
Update the print area across similarly formatted Excel worksheets without setting it separately on each sheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A workbook contains multiple worksheets that should use the same cell range for printing.
- Observed behavior
- The user wants all worksheets to use the print area defined on the first worksheet.
Confirm that the worksheets use the same cell layout and that the first worksheet is the one with the desired print area. Use a desktop version of Excel that supports VBA; Excel for the web cannot run VBA macros.
Copy the first worksheet's print area with a VBA macro
Use this method to apply the same print range to every other worksheet in the workbook.
On the first worksheet, select the cells to print, then choose Page Layout > Print Area > Set Print Area.
Open the VBA editor from Developer > Visual Basic. If the Developer tab is not visible, enable it through Excel's ribbon settings.
In the VBA editor, select the target workbook in the Project pane, then choose Insert > Module.
Paste the following code into the module, place the cursor inside the macro, and choose Run > Run Sub/UserForm: Sub CopyPrintArea() Dim printRange As String Dim i As Long printRange = ThisWorkbook.Worksheets(1).PageSetup.PrintArea If printRange = "" Then MsgBox "Set a print area on the first worksheet first." Exit Sub End If For i = 2 To ThisWorkbook.Worksheets.Count ThisWorkbook.Worksheets(i).PageSetup.PrintArea = printRange Next i End Sub
Open File > Print and preview a few worksheets to confirm the correct cells are included. To keep the macro, use File > Save As and select Excel Macro-Enabled Workbook (*.xlsm).

Work with Excel worksheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel files and work with worksheets and print settings while transitioning from Microsoft Office.

Frequently Asked Questions
Will the macro change the first worksheet's print area?
No. It reads the first worksheet's existing print area and assigns it to each subsequent worksheet.
What happens if the first worksheet has no print area?
The macro displays a message and stops. Select the desired cells on the first worksheet and choose Page Layout > Print Area > Set Print Area before running it again.
Can I run this VBA macro in Excel for the web?
No. Open the workbook in a desktop version of Excel that supports VBA, then use Developer > Visual Basic to add and run the macro.
Will the macro preserve existing print areas on the other worksheets?
No. It replaces each subsequent worksheet's print area with the range from the first worksheet.
How do I keep the macro in the workbook?
In Excel, choose File > Save As and select Excel Macro-Enabled Workbook (*.xlsm).




