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

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?
Sandra SmithRetiredAsked:
Who is Participating?
 
rspahitzConnect With a Mentor Commented:
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
 
rspahitzCommented:
How about this VBA code?

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

Where "SomeRange" is the named range.
0
 
Sandra SmithRetiredAuthor Commented:
I need to turn the PrintArea set by the user into a named range.  That is, create the named range from the PrintArea.
0
Get expert help—faster!

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

 
McOzCommented:
You can assign printarea to a named range without VBA. See screencast:
McOz-415518.flv
0
 
McOzCommented:
Oops! missed your comment above. To set the RangeName to the Print_Area, just do the same in reverse.

Good luck!
0
 
Sandra SmithRetiredAuthor Commented:
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
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.

All Courses

From novice to tech pro — start learning today.