Hiding Rows

G

Graham Moore

I have a cell that has 0 for a total and I want to hide the entire row that
cell is in. Expamle: if cell A1 is '0', I want to hide row 1. Any ideas
how I can do that. I am using excel 2003.
Thanks
Graham
 
P

Pete_UK

Apply autofilter to that column. From the filter drop-down choose
Custom and in the pop-up panel select Does not equal and then put 0
(zero) in the other box, then OK. This will hide those rows that
contain a zero in that column.

Hope this helps.

Pete
 
M

Mike H

Hi,

Select A1 then
data|Filter|Autofilter

click the down arrow and rom the dropdown select 'Does not equal'
enter 0 (zero)

OK

Mike
 
J

JBeaucaire

Here's a macro that will do it, you can adjust it:

==========
Sub HideRows()

Application.ScreenUpdating = False
Application.EnableEvents = False

Dim cell As Range

For Each cell In Worksheets(1).Range("A1:A100")
cell.EntireRow.Hidden = Len(cell.Text) = 0
Next cell

Application.EnableEvents = True
End Sub
==========
This macro runs on the first sheet, regardless of what it's called. Change
the numeral 1 to whatever sheet number (in order) you wish to run it on. And
also, adjust the A1:A100 to as many or as few rows as you want.

Paste the code above into a normal VB Module.

Press Alt-F11
Click Insert>Module
Paste in the code
Press Alt-Q
Save your sheet

Run your new macro! Is this something you can work with?
 
S

Susan

correction - JBeaucaire forgot to turn back on
screenupdating..........
==========
Sub HideRows()


Application.ScreenUpdating = False
Application.EnableEvents = False


Dim cell As Range


For Each cell In Worksheets(1).Range("A1:A100")
cell.EntireRow.Hidden = Len(cell.Text) = 0
Next cell

Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
==========
:)
susan
 
J

JBeaucaire

The devil is in the details. Thank you Susan. Got my vote and corrected my
archived code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top