+ Reply to Thread
Results 1 to 4 of 4

Using named ranges to set printarea

  1. #1
    Registered User
    Join Date
    07-18-2022
    Location
    Manchester England
    MS-Off Ver
    MS365
    Posts
    91

    Using named ranges to set printarea

    I have a worksheet which is divided into 12 monthly areas named like JAN_22. I am trying to write a routine that takes the month, chosen earlier and uses this to select the relevant named range and uses this as the PrintArea. My latest attempt is this :-
    Please Login or Register  to view this content.
    PrintMonth is one of the named ranges ie Jan_22 or Jul_22.
    The attached workbook shows 3 months with named ranges for each of these.
    The code above fails at .PrintArea = .Range(PrintMonth).Address.
    I hope somebody can point me in the right direction,
    John
    Attached Files Attached Files

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: Using named ranges to set printarea

    All you should need is:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    07-18-2022
    Location
    Manchester England
    MS-Off Ver
    MS365
    Posts
    91

    Re: Using named ranges to set printarea

    Rorya
    In the light of your post I changed my DoPrint sub as follows
    Please Login or Register  to view this content.
    This provided a landscaped print of the right named range but magnified to 6 x A4 sheets. The code had ignored the FitToPagesWide and Tall.
    Apart from your contribution the rest of the coding was extracted from a Macro . I am still going wrong can you see where?
    John

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: Using named ranges to set printarea

    Sorry for the delay, I have been away.

    You need to add:

    Please Login or Register  to view this content.
    for the fittopages options to work.

+ 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. Can I define a printarea using a named range
    By Osprey2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-16-2022, 11:49 AM
  2. How to set PrintArea to a named range
    By Osprey2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2021, 11:27 AM
  3. [SOLVED] Get Pages Ranges of PrintArea
    By Gatti in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2016, 04:50 PM
  4. [SOLVED] VBA creates named ranges, but named ranges disappear
    By BrotherNeptune in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2015, 03:22 PM
  5. Define only 2 named ranges from a list of named ranges...
    By abhi900 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-29-2014, 04:20 AM
  6. Looping Mutliple Named Resized Ranges in next empty row below another named range
    By gingumdog in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2014, 08:15 PM
  7. [SOLVED] Determining if the value of a cell can be a named range, then assigning named ranges after
    By Romulo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2013, 06:05 PM

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