Print area in Excel, how to assign it to a range

Posted on 2011-03-02
Medium Priority
Last Modified: 2012-05-11
I am tring to devleop a resizing program for our users to use during our massive rebranding project.  A report could have three columns, or five, but it has to remain with certain margin paramaters.  So, the first step I thought would be to turn the PageArea that is set by the user into a range (due to spaces between rows for "prettiness" cannot simpy use the UsedRange function).  Is that possible?  To take the PrintArea and assign it a RangeName with VBA?
Question by:ssmith94015
  • 2
  • 2
  • 2
LVL 22

Expert Comment

ID: 35018978
How about this VBA code?

ActiveSheet.PageSetup.PrintArea = Range("SomeRange").Address

Where "SomeRange" is the named range.

Author Comment

ID: 35019008
I need to turn the PrintArea set by the user into a named range.  That is, create the named range from the PrintArea.

Expert Comment

ID: 35019052
You can assign printarea to a named range without VBA. See screencast:
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Expert Comment

ID: 35019065
Oops! missed your comment above. To set the RangeName to the Print_Area, just do the same in reverse.

Good luck!
LVL 22

Accepted Solution

rspahitz earned 2000 total points
ID: 35019106
It actually is already a named range called Print_Area.  you'll see if if you go to the name box (top left corner, just above the grid, click the dropdown arrow)
To you want it to have a different name also?

    ActiveWorkbook.Names.Add "NewName1", _
        "=" & Range("Print_Area").Address

Author Closing Comment

ID: 35019197
rspahtiz, that was what I was trying to find!  I figured it was somewhere but I was just not putting in the correct search criteria.

McOz, liked the video, but this all has to be done in VBA.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

619 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