Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Setting Print Ranges for Multiple Worksheets.

Setting Print Ranges for Multiple Worksheets

by Allen Wyatt
(last updated June 8, 2018)

3

Martin asked if there is a way to set print ranges for multiple worksheets at the same time. He has a workbook containing a number of worksheets structured exactly the same, and he wants their respective print ranges to be exactly the same.

As Martin has discovered, there is no way to do this directly in Excel. When you select multiple worksheets, select the area you want set as the print area, and then try to set the print area, you quickly discover that the option to do the setting is grayed out, so you cannot select that option.

There are several things you can try, however. One is to start with a new workbook and develop a single worksheet that contains the print area as you would want it on all worksheets. Then, copy the worksheet however many times desired in the workbook. The copied worksheets will have the print area set as it was in the first worksheet.

The other option is to create a macro that will do the print-area setting for you. Consider the following macro, which will set the print area for all the selected worksheets to whatever the print area is on the active worksheet. (When more than one worksheet is selected, the active worksheet is the one that is visible when you run the macro.)

Sub SetPrintAreas1()
    Dim sPrintArea As String
    Dim wks As Worksheet

    sPrintArea = ActiveSheet.PageSetup.PrintArea
    For Each wks In ActiveWindow.SelectedSheets
        wks.PageSetup.PrintArea = sPrintArea
    Next
    Set wks = Nothing
End Sub

If you prefer to have the print area set to some range that you specify, rather than needing to set the print area on the active worksheet first, then you can make one small change to the macro so that it uses a range for the print area:

Sub SetPrintAreas2()
    Dim sPrintArea As String
    Dim wks As Worksheet

    sPrintArea = "A7:E22"
    For Each wks In ActiveWindow.SelectedSheets
        wks.PageSetup.PrintArea = sPrintArea
    Next
    Set wks = Nothing
End Sub

To choose a different print area for your needs, replace the range that is assigned to the sPrintArea variable. If you figure that you may use the macro quite a bit, in a number of different workbooks, or if you figure that you may need to change the print area regularly, you could change the macro so that it prompts the user for a range to use:

Sub SetPrintAreas3()
    Dim sPrintArea As String
    Dim wks As Worksheet

    sPrintArea = InputBox("Enter print area range")
    For Each wks In ActiveWindow.SelectedSheets
        wks.PageSetup.PrintArea = sPrintArea
    Next
    Set wks = Nothing
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9365) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Setting Print Ranges for Multiple Worksheets.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Understanding AutoComplete

Entering data in a worksheet can be time consuming. One of the tools that Excel provides to make entry easier is ...

Discover More

Using Find and Replace to Change Text Case

Can you really use Find and Replace to change the case of text in your document? Not really, but that shouldn't stop you ...

Discover More

Inserting a Watermark Behind Merged Cells

If you have a group of merged cells into which you want a user to enter information, you may want some sort of ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Setting the Print Area

Many people, when they print a worksheet, print the entire thing. You don't have to, however. You can specify that Excel ...

Discover More

Printing Multiple Selections

Need to print several portions of a worksheet all on a single piece of paper? Here's an easy way you can get what you ...

Discover More

Copying Print Areas when Copying Worksheets

Print areas are a great way to define what, exactly, you want to print from a worksheet. When you copy worksheets, the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is seven less than 9?

2018-06-12 03:19:56

Rob

And non-contiguous print areas can be specified, here is code that sets up print areas based on checkbox values:

Dim rngPrintArea As Range ' the range used to set the non-contiguous print area.

' check print Title page
If chkPrintTitle.Value = True Then
If rngPrintArea Is Nothing Then
Set rngPrintArea = Range("B1:O146") ' title page cells
Else
Set rngPrintArea = Union(rngPrintArea, Range("B1:O146"))
End If
End If

' check print Worksheets:
If chkPrintWorksheets.Value = True Then
If rngPrintArea Is Nothing Then
Set rngPrintArea = Range("B234:O279") ' worksheet cells
Else
Set rngPrintArea = Union(rngPrintArea, Range("B234:O279"))
End If
End If

' Set the print area:
ActiveSheet.PageSetup.PrintArea = rngPrintArea ' Set print area.


2014-10-20 04:48:28

Dave S

Tom
You could call a SetPrintAreas macro from within the worksheet's SelectionChange event, passing the selected range as a variable. If the print area is relatively large, a check on the cell count could be used to prevent spurious calls every time you move around the worksheet. Something like:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range

Set rng = Target

If rng.Count > 10 Then
Call SetPrintAreas(rng)
End If

End Sub


2014-10-19 09:51:45

Tom

Is there a way to use the third option to allow the user to select a range on the actual worksheet? As opposed to typing in the range as required by the existing code.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.