Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Setting Print Area

I have a number of similar worksheets that I want to open through a script
and print only the last page of data. Each worksheet has varrying amounts of
data that change each month so I have a formula in each (in cell G1) that
displays the range equal to the last page of data (formula evaluates to
A125:E156 for instance).

As I open each worksheet with the script, how do I set the Print Range equal
to the range the formula returns?

Thanks,

Pete
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Setting Print Area

Figured it out.

ActiveSheet.PageSetup.PrintArea = Range("g1").Value

"dolppm" wrote:

I have a number of similar worksheets that I want to open through a script
and print only the last page of data. Each worksheet has varrying amounts of
data that change each month so I have a formula in each (in cell G1) that
displays the range equal to the last page of data (formula evaluates to
A125:E156 for instance).

As I open each worksheet with the script, how do I set the Print Range equal
to the range the formula returns?

Thanks,

Pete

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Setting Print Area

Another solution would be to use a dynamic print area. Since Excel uses a
named range to define the print area of a worksheet, you could redefine this
range as dynamic. To do this go to menu "Insert - menu - define" and look
for range Print_Area. Set it to something like this:

=OFFSET(Sheet1!$A$19,0,0,COUNTA(Sheet1!$A:$A),COUN TA(Sheet1!$19:$19))

Formula explanation:
"Sheet1!$A$19" is the upper left starting cell of the print area (this
usually does not change for most users)
"COUNTA(Sheet1!$A:$A)" returns the number of non-empty cells in column A
"COUNTA(Sheet1!$19:$19)" returns the number of non-empty cells in row 19

Hope it helps !

DaVinci

"dolppm" wrote:

I have a number of similar worksheets that I want to open through a script
and print only the last page of data. Each worksheet has varrying amounts of
data that change each month so I have a formula in each (in cell G1) that
displays the range equal to the last page of data (formula evaluates to
A125:E156 for instance).

As I open each worksheet with the script, how do I set the Print Range equal
to the range the formula returns?

Thanks,

Pete

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
Print Area Setting RozBuds Excel Discussion (Misc queries) 3 February 19th 10 09:41 PM
Setting The Print-Area ? Robert11[_3_] New Users to Excel 2 May 31st 09 03:24 PM
Setting print area richzip Excel Discussion (Misc queries) 1 April 27th 08 08:10 AM
Setting print area with vba KimberlyC Excel Programming 3 December 18th 04 12:46 AM
Setting print area Don Guillett[_4_] Excel Programming 0 September 4th 03 02:14 PM


All times are GMT +1. The time now is 07:47 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"