Solved

How to set print area for multiple sheets in Excel 2003

Posted on 2012-03-14
2
280 Views
Last Modified: 2012-06-21
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
Comment
Question by:mishlce
2 Comments
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
ID: 37722741
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
 

Author Closing Comment

by:mishlce
ID: 37725082
This worked Perfect!!  Thank you so much.  Huge time saver!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now