Hide rows in range when value in COL A = 0

JamesGilchrist

New Member
Joined
Apr 12, 2011
Messages
13
Hi All,

Need some code to do the following.

For a range of rows from Row 10 to 50000
Hide any row where COL A has a value = 0

Many thanks....sorry for such a numpty question.

James
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
If the 0 is NOT the result of a formula, use

Code:
Sub MM1()
  With Range("A1", Cells(Rows.Count, "A").End(xlUp))
    .Replace 0, "#N/A", xlWhole, , False, , False, False
    Columns("A").SpecialCells(xlConstants, xlErrors).EntireRow.Hidden = True
  End With
End Sub
 
Upvote 0
Is filtering (either manually or with code) on doesn't equal zero an option?
 
Upvote 0
Maybe then...

Code:
Sub MM2()
Range("a10:a50000").AutoFilter Field:=1, Criteria1:="<>0"
End Sub
 
Upvote 0
Hi Michael, sure not A9 rather than A10 for the header row ;)
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top