ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set print area (https://www.excelbanter.com/excel-programming/427747-set-print-area.html)

Porky79

Set print area
 
Hi guys,

I am successfully using the following macro to define and set print
area based on the presence of a column header in row A.

Range("A1:Z52").Select
ActiveSheet.PageSetup.PrintArea = "A1:OFFSET(A1,51,COUNTA
(A1:Z1)-1)"

I have now set a formula in row A for each column that will leave the
cell blank if not data is entered into a specified cell (formula used:
=IF(T2,T2,"")).

However the macro I am running to set print area obviously works on
counting blank cells and the fact that the cell contains a formula
(albeit noting is displayed) is not classed as blank.

Can anyone suggest an alternative PrintArea macro that will set print
area so that only columns with a header displayed in row A will be
printed?

Any help much appreciated (as always)

Best wishes

Paul


All times are GMT +1. The time now is 03:44 PM.

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