Print macro

L

LiAD

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
 
B

Barb Reinhardt

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
 
L

LiAD

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top