Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatically Sizing PrintArea


I was wondering if anyone could suggest a method to dynamically set
PrintArea on a worksheet according to the last used row (the # o
colums will always be constant).

I know to use -Sheet1-.PageSetup.PrintArea = "-A1:F15-" but i can'
figure out how to find the last row with data in it and get th
appropriate range from that last row.

Thanks,

To

--
ob3ron0
-----------------------------------------------------------------------
ob3ron02's Profile: http://www.excelforum.com/member.php...fo&userid=1545
View this thread: http://www.excelforum.com/showthread.php?threadid=27079

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automatically Sizing PrintArea

If you don't set any printarea, it should do what you want.

but,
Last non-empty cell in column A

Dim rng as Range
set rng = Cells(rows.count,1).end(xlup)
' assume 10 columns wide
set rng = Range(Range("A1"), rng).Resize(,10)

Activesheet.PageSetup.PrintArea = rng.Address(external:=True)

--
Regards,
Tom Ogilvy


"ob3ron02" wrote in message
...

I was wondering if anyone could suggest a method to dynamically set a
PrintArea on a worksheet according to the last used row (the # of
colums will always be constant).

I know to use -Sheet1-.PageSetup.PrintArea = "-A1:F15-" but i can't
figure out how to find the last row with data in it and get the
appropriate range from that last row.

Thanks,

Tom


--
ob3ron02
------------------------------------------------------------------------
ob3ron02's Profile:

http://www.excelforum.com/member.php...o&userid=15450
View this thread: http://www.excelforum.com/showthread...hreadid=270797



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically re-sizing merged cells LongTermNoob Excel Worksheet Functions 1 March 28th 07 10:42 AM
automatically sizing text with graphs Shoque Charts and Charting in Excel 1 August 2nd 06 03:30 PM
Sizing row height automatically Stewart Allen Excel Programming 2 February 18th 04 07:44 PM
PRINTAREA Giacomo[_3_] Excel Programming 4 October 28th 03 10:43 PM
Sizing windows automatically tom Troyer Excel Programming 1 July 9th 03 04:43 AM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"