Solved

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

Posted on 2011-03-02
6
318 Views
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?
0
Comment
Question by:ssmith94015
  • 2
  • 2
  • 2
6 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 35018978
How about this VBA code?

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

Where "SomeRange" is the named range.
0
 

Author Comment

by:ssmith94015
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.
0
 
LVL 9

Expert Comment

by:McOz
ID: 35019052
You can assign printarea to a named range without VBA. See screencast:
McOz-415518.flv
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 9

Expert Comment

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

Good luck!
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 500 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
0
 

Author Closing Comment

by:ssmith94015
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.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

758 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

20 Experts available now in Live!

Get 1:1 Help Now