Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Printing / April 2006

Tip: Looking for answers? Try searching our database.

Area Selected as print area

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Agustus - 30 Mar 2006 20:43 GMT
Hi,

I have selected a range on on the activeworksheet. How do I set the
range into the print area using VBA?

TIA
David McRitchie - 31 Mar 2006 04:49 GMT
Hi Agustus,

Record a macro
  Select area,  File,  Print area

 VBA code generated
      ActiveSheet.PageSetup.PrintArea = "$A:$F"

 you can use
      ActiveSheet.PageSetup.PrintArea = Selection.address
or with another range
      ActiveSheet.PageSetup.PrintArea = rng.address

The need to set a Print Area is off due to last cell problems
   you can check last cell with   Ctrl+End    for the intersection
   of the last used row and the last use column as Excel knows it.

More information in
  http://www.mvps.org/dmcritchie/excel/lastcell.htm
For a macro to fix all worksheets in a workbook see

 Why do my scrollbars go to row 500 -- my data ends in cell E50?, contextures.com, Debra Dalgleish
    http://www.contextures.com/xlfaqApp.html#Unused        use the macro under that topic
---
HTH,
David McRitchie, Microsoft MVP - Excel    [site changed  Nov. 2001]
My Excel Pages:  http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:        http://www.mvps.org/dmcritchie/excel/search.htm

> Hi,
>
> I have selected a range on on the activeworksheet. How do I set the
> range into the print area using VBA?
>
> TIA
Agustus - 26 Apr 2006 18:46 GMT
Thanks, David. Your tips are very helpful.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.