• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

How to set print area for multiple sheets in Excel 2003

I have a report that contains 189 worksheets in one book. I set up my first sheet with the print area I am looking for and none of the other sheets are set up this way.  I tried to select all 189 tabls and set print area but it will only let do one sheet at a time?  It is greyed out and will not allow me to choose this option.  Any help would be appreciated.  Thanks.
0
mishlce
Asked:
mishlce
1 Solution
 
dlmilleCommented:
While you can certainly select all tabs and print, you have to set the print area on a workbook, one sheet at a time.

Here's a macro you can use that will take the CURRENT sheet's print area, and propogate it to the rest of the workbook.  

Option Explicit

Sub setPrintAreaWkb()
Dim wkb As Workbook
Dim wks As Worksheet
Dim wksSet As Worksheet
Dim r As Range

    Set wkb = ActiveWorkbook
    Set wks = wkb.ActiveSheet
    
    On Error Resume Next
    Set r = wks.Range("'" & wks.Name & "'!Print_Area")
    If Err.Number <> 0 Then
        MsgBox "First, Set the print area for one sheet, then on that sheet, run this macro to propogate the same print area across the workbook.", vbCritical, "Aborting!  Try again"
    Else
        On Error GoTo 0
        
        For Each wksSet In wkb.Worksheets
            If wksSet.Name <> wks.Name Then 'change the print area setting
                wksSet.Range(wks.Range("Print_Area").Address).Name = "'" & wksSet.Name & "'!Print_Area"
            End If
        Next wksSet
    End If
    
    MsgBox "Print Areas are now set to active sheet's settings in the entire workbook"
End Sub

Open in new window


Hope this helps!

See attached demonstration workbook.

Just set the print area to a different range on the Sheet1 sheet (that's where the macro button is) and then hit the button.  All worksheet tabs will then have that same range as their respective print areas.

Dave
setPrintAreaEntireWorkbook-r1.xls
0
 
mishlceAuthor Commented:
This worked Perfect!!  Thank you so much.  Huge time saver!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now