ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to hide rows containing no data (https://www.excelbanter.com/excel-programming/296202-macro-hide-rows-containing-no-data.html)

john

Macro to hide rows containing no data
 
My spreadsheet is A1:Q308. I would like only the rows
which contain a value in the Q column that is less than
zero or greater than zero to be printed. There are also
some blank rows which contain no data or formulas in the
A1:Q308 worksheet. I would like the macro to search the
sheet, suppress the rows that do not qualify for display,
and let me print what remains.

Dave Peterson[_3_]

Macro to hide rows containing no data
 
I think I wouldn't use a macro.

I'd select the range and do Data|Filter|autofilter.

You can use the dropdown on each header cell and show or hide the values you
want.

There's even an option for Custom.

"Does not equal" 0
And
"does not equal" (leave blank)

may be useful.

John wrote:

My spreadsheet is A1:Q308. I would like only the rows
which contain a value in the Q column that is less than
zero or greater than zero to be printed. There are also
some blank rows which contain no data or formulas in the
A1:Q308 worksheet. I would like the macro to search the
sheet, suppress the rows that do not qualify for display,
and let me print what remains.


--

Dave Peterson


Paul Lautman

Macro to hide rows containing no data
 
HAve you thought of just using Auto Filter?

"John" wrote in message
...
My spreadsheet is A1:Q308. I would like only the rows
which contain a value in the Q column that is less than
zero or greater than zero to be printed. There are also
some blank rows which contain no data or formulas in the
A1:Q308 worksheet. I would like the macro to search the
sheet, suppress the rows that do not qualify for display,
and let me print what remains.




N10

Macro to hide rows containing no data
 

"Paul Lautman" wrote in message
...
HAve you thought of just using Auto Filter?

"John" wrote in message
...
My spreadsheet is A1:Q308. I would like only the rows
which contain a value in the Q column that is less than
zero or greater than zero to be printed. There are also
some blank rows which contain no data or formulas in the
A1:Q308 worksheet. I would like the macro to search the
sheet, suppress the rows that do not qualify for display,
and let me print what remains.




tHIS SEEMS TO WORK

Sub ENTIREROWS()

Dim X As Range


Dim FLAG As Integer
Range("A1").Select
For Each Row In ActiveSheet.UsedRange
For Each CELL In Row
CELL.Select
If CELL.Value "" Then FLAG = 1
Next
If FLAG < 1 Then ActiveCell.Select
If FLAG < 1 Then Selection.EntireRow.Delete
FLAG = 0
Next
End Sub

N10




All times are GMT +1. The time now is 05:39 PM.

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