LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Dynanic Print Range

Having a small problem with setting up a dynamic print range. I have defined
a range by clicking insertnamedefine. Named range is PrintArea and below
is the formula:

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),4)

I have also inserted the following vba code into the workbook:

Private Sub Workbook_BeforePrint (Cancel As Boolean)
With ActiveSheet
..PageSetup.PrintArea = .Range(.Range("A1"),
..Range("PrintArea").Cells(.Range("PrintArea").Cel ls.Count)).Address


This setup does exactly what I need with a workbook with only 1 worksheet.
However, I need help on adjusting this to work with a workbook with multiple
worksheets. Can the dynamic range be defined in vba using ActiveSheet, and
if so, what would that look like? I'm looking for something other than a
dynamic print range for every worksheet.
 
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 range won't print Cheri K Excel Discussion (Misc queries) 2 February 25th 10 11:49 PM
Dynanic Worksheet functions Les G Excel Worksheet Functions 16 November 11th 07 06:46 AM
Print Blank Pgs - Preview margins outside print range dsm Excel Discussion (Misc queries) 0 October 25th 06 06:17 PM
Can you get the range reference for each page in a worksheet print range? Crosby Excel Programming 3 April 12th 05 06:06 PM
Excel 2000 VBA - Set Print Range in dynamic range sub_pop[_5_] Excel Programming 2 July 27th 04 08:01 PM


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