+ Reply to Thread
Results 1 to 2 of 2

Help! Set Ranges Based on Print Areas in VBA?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-23-2013
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    7

    Help! Set Ranges Based on Print Areas in VBA?

    Hi,

    I am trying to copy and paste values from specific ranges within specific worksheets into a new workbook using VBA. Is there a way to set the ranges based on the print areas I have already set for each of these worksheets? I am trying to avoid having to set a different range for each individual worksheet.

    Thanks!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Help! Set Ranges Based on Print Areas in VBA?

        Dim wks         As Worksheet
        Dim r           As Range
    
        Set wks = ActiveSheet
    
        With wks
            If Len(.PageSetup.PrintArea) Then
                Set r = .Range(.PageSetup.PrintArea)
            Else
                Set r = .UsedRange
            End If
        End With
    Last edited by shg; 07-23-2013 at 06:10 PM.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA code to print several print areas in one worksheet
    By ABSTRAKTUS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2010, 03:24 PM
  2. Macro need to change print areas based on Populated rows
    By awaring in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2010, 02:01 PM
  3. How to print multiple print areas on the same page.
    By Dalilah in forum Excel General
    Replies: 5
    Last Post: 08-27-2008, 09:05 AM
  4. Print ranges based on cell value
    By John in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2006, 10:45 PM
  5. [SOLVED] printing multiple print areas with a print dialog box
    By LHaro in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2005, 05:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1