ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print Area (https://www.excelbanter.com/excel-programming/319396-print-area.html)

JT[_2_]

Print Area
 
I want to set the print area with my macro. If I know the
ending row, I can use the following formula:

ActiveSheet.PageSetup.PrintArea = "$A$1:$L$101"

However. the last row will be different every time. It
will always be column L.

Is there a better way to do this? Any help or suggestions
would be apprecatiated. Thanks.

JE McGimpsey

Print Area
 
One way:

With ActiveSheet
.PageSetup.PrintArea = .Range(.Cells(1, 1), _
.Cells(.Rows.Count, 12).End(xlUp)).Address
End With

In article ,
"JT" wrote:

I want to set the print area with my macro. If I know the
ending row, I can use the following formula:

ActiveSheet.PageSetup.PrintArea = "$A$1:$L$101"

However. the last row will be different every time. It
will always be column L.

Is there a better way to do this? Any help or suggestions
would be apprecatiated. Thanks.



All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com