#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Print macro

Morning,

In col R of sheets 4 to 11, (named a b c etc), I have a list of numbers
which ascend from 1. I would like to use these numbers to set a print range.
The print range should be

A1:O(last line of interest)

The last line of interest is last line with a number greater than zero. So
for example in -:

Sheet 4 the number list starts in row 1 and reads 1 1 1 1 1 2 3 4 5 6 0 0 0
0 so the print range should be A1:O10.
Sheet 5 it reads 23 23 23 23 23 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
0 0 0 0 so the print range should be A1:O23.

Is it possible to have a macro that sets the print range for each sheet and
then prints the sheets accordingly, with the printer selected from the usual
pop-up dialogue box.

Thanks
LiAD

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Print macro

Try recording a macro when you set the print area to what you want.

Then you'll need to tweak it a bit. YOu can get the last row in column O
this way

Dim lRow as long
Dim aWS as excel.worksheet
set aWS = activesheet

lrow = aws.range("O"&aws.rows.count).end(xlup).row

--
HTH,

Barb Reinhardt



"LiAD" wrote:

Morning,

In col R of sheets 4 to 11, (named a b c etc), I have a list of numbers
which ascend from 1. I would like to use these numbers to set a print range.
The print range should be

A1:O(last line of interest)

The last line of interest is last line with a number greater than zero. So
for example in -:

Sheet 4 the number list starts in row 1 and reads 1 1 1 1 1 2 3 4 5 6 0 0 0
0 so the print range should be A1:O10.
Sheet 5 it reads 23 23 23 23 23 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
0 0 0 0 so the print range should be A1:O23.

Is it possible to have a macro that sets the print range for each sheet and
then prints the sheets accordingly, with the printer selected from the usual
pop-up dialogue box.

Thanks
LiAD

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Print macro

Sorry i forgot to say that the number list is in col R - therefore outside
the print area. I'm not sure how to create something to this.

Thanks

"Barb Reinhardt" wrote:

Try recording a macro when you set the print area to what you want.

Then you'll need to tweak it a bit. YOu can get the last row in column O
this way

Dim lRow as long
Dim aWS as excel.worksheet
set aWS = activesheet

lrow = aws.range("O"&aws.rows.count).end(xlup).row

--
HTH,

Barb Reinhardt



"LiAD" wrote:

Morning,

In col R of sheets 4 to 11, (named a b c etc), I have a list of numbers
which ascend from 1. I would like to use these numbers to set a print range.
The print range should be

A1:O(last line of interest)

The last line of interest is last line with a number greater than zero. So
for example in -:

Sheet 4 the number list starts in row 1 and reads 1 1 1 1 1 2 3 4 5 6 0 0 0
0 so the print range should be A1:O10.
Sheet 5 it reads 23 23 23 23 23 23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
0 0 0 0 so the print range should be A1:O23.

Is it possible to have a macro that sets the print range for each sheet and
then prints the sheets accordingly, with the printer selected from the usual
pop-up dialogue box.

Thanks
LiAD

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
write a macro to print to search a list and print certain workshee Scott Smith[_2_] Excel Programming 3 September 26th 08 10:35 PM
Macro to hide rows with a certain cell empty then set print area and print tahrah Excel Programming 12 January 9th 07 03:47 AM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM


All times are GMT +1. The time now is 03:24 AM.

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

About Us

"It's about Microsoft Excel"