ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I select a range to print if I have different numbers of ro (https://www.excelbanter.com/excel-programming/325912-how-do-i-select-range-print-if-i-have-different-numbers-ro.html)

Charles Bennington

How do I select a range to print if I have different numbers of ro
 
The difficulty I am having is because I could use select current region but I
have one column that includes a IF formula that returns a zero even if other
cells in the row are blank. Accordingly select current region includes all
the rows with zero values from the IF statement

Shawn O'Donnell

How do I select a range to print if I have different numbers of ro
 
"Charles Bennington" wrote:
The difficulty I am having is because I could use select current region but I
have one column that includes a IF formula that returns a zero even if other
cells in the row are blank. Accordingly select current region includes all
the rows with zero values from the IF statement


Two options for you to consider:

1. change the IF statement so that it returns "" instead of 0. If 0 can be
a valid answer for non-empty rows, however, that won't work.

2. Nest your IF statement inside another IF statement. The outer IF tests
enough of the other columns to tell if it should execute the inner IF or give
up and display nothing.

That is, if it was enough to know if column A is empty, then

=IF( A2 <"", IF([your original IF statement]), "" )


Charles Bennington[_2_]

How do I select a range to print if I have different numbers o
 
Thanks Shawn - in the end I used the following approach (found elsewhere on
the discussion groups). The problem I was having is that the use of double
double quotes(!) returns a zero in the cell meaning the print rang was
including lots of rows with only a zero to print!

Range("A65536").Select
Selection.End(xlUp).Select
intLastRow = ActiveCell.Row
ActiveSheet.PageSetup.PrintArea = "$A$1:$L$" & intLastRow
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Thanks for the help

"Shawn O'Donnell" wrote:

"Charles Bennington" wrote:
The difficulty I am having is because I could use select current region but I
have one column that includes a IF formula that returns a zero even if other
cells in the row are blank. Accordingly select current region includes all
the rows with zero values from the IF statement


Two options for you to consider:

1. change the IF statement so that it returns "" instead of 0. If 0 can be
a valid answer for non-empty rows, however, that won't work.

2. Nest your IF statement inside another IF statement. The outer IF tests
enough of the other columns to tell if it should execute the inner IF or give
up and display nothing.

That is, if it was enough to know if column A is empty, then

=IF( A2 <"", IF([your original IF statement]), "" )



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

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