![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 09:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com