ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting print area (https://www.excelbanter.com/excel-programming/276061-re-setting-print-area.html)

Don Guillett[_4_]

Setting print area
 
try
botcell & "

"nath" <n@n wrote in message ...
Hi

I am trying to write some code for a button to set the
print area of a sheet to only include the relevant data.
I have coded this so far

With ActiveSheet.PageSetup ' Set up printing
preferences

.PrintArea = "$B$2:$" & col_name & "$" & botcell
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 2
.CenterHeader = "4 Region BAAG report"

End With

where col_name is the last column of relevant data. Which
comes from some earlier code.

When i run this i get an error message saying that the
print area can not be set.

Can any one help?

TIA

Nath.





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

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