#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Print Dynamic Range

I have a basic excel template used for ordering parts. It runs from A1:N250
and I can print easily repeating rows 1:11 on each page (contains job details)

. Trouble is sometimes there may only be 10 part numbers requiring only first
page and I finish up throwing away trees by printing entire sheet! I know I
can reset print area each time am setting this up on Sharepoint for multi
users and need a macro/button to recognise number of items and print
accordingly. Any help greatly appreciated

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Print Dynamic Range

Sub SetPrintArea()
'change this constant
'to point to the column
'that will Always have entries
'down to the last used row on
'the parts order sheet
'it should be a column that
'you type data into, not one
'with a formula.
Const keyColumn = "A"

ActiveSheet.PageSetup.PrintArea = "$A$1:$N$" _
& Range(keyColumn & Rows.Count).End(xlUp).Row
ActiveWindow.SelectedSheets.PrintOut Copies:=1

End Sub

Put this macro into your workbook:
Open the workbook, press [Alt]+[F11] to open the VB Editor then choose
Insert -- Module and copy and paste the code into the code module presented
to you. Change the letter for the 'keyColumn' as needed. Close the VB
Editor.

Add a button from the Forms toolbar or a text box to your worksheet and
assign the macro to it so that when it is clicked, the print area will be
reset and a copy of the sheet will be printed.


"Bruister via OfficeKB.com" wrote:

I have a basic excel template used for ordering parts. It runs from A1:N250
and I can print easily repeating rows 1:11 on each page (contains job details)

. Trouble is sometimes there may only be 10 part numbers requiring only first
page and I finish up throwing away trees by printing entire sheet! I know I
can reset print area each time am setting this up on Sharepoint for multi
users and need a macro/button to recognise number of items and print
accordingly. Any help greatly appreciated

--
Message posted via http://www.officekb.com

.

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
How do I make a dynamic print range in excel? Herd Excel Discussion (Misc queries) 4 August 15th 09 03:15 AM
Print Area as dynamic range? Michael.Tarnowski Excel Worksheet Functions 1 March 8th 09 04:02 PM
Dynamic Print Range with cells containing formulas ! LP Excel Discussion (Misc queries) 1 March 13th 08 07:23 PM
Macro print range not dynamic like I wanted it to be TRYING Excel Worksheet Functions 8 November 27th 07 01:05 AM
Dynamic Print Range Help waxwing Excel Worksheet Functions 2 February 21st 05 03:47 PM


All times are GMT +1. The time now is 11:28 PM.

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"