more help with a hide macro

  • Thread starter Thread starter Awoll
  • Start date Start date
A

Awoll

Hello again,

I got some help with a hide macro for searching for a spcific word, and it
worked great. Now i'm trying to hide any row that has a 0 value in the b
column. if it is any other number. I want it to remain. I tried changing the
macro, but it hides everything and can't get it to work.

Any help would be greatly appreciated.

Thanks,

Aaron
 
With only limited information:

set rng = Columns(2).SpecialCells(xlConstants,xlNumbers)
for each cell in rng
if cell.Value = 0 then
cell.EntireRow.Hidden = True
else
cell.Entirerow.Hidden = False
end if
Next

if the zeros are produce by formula, change xlconstants to xlFormulas
 
Awsome, the zero are produced by a if function so i'm hoping that the
xlForumulas will work. Is there anyway to specify the worksheet that it runs
on?
 
Dim rng as Range, cell as Range
With Worksheets("Sheet3")
set rng = .Columns(2).SpecialCells(xlFormulas,xlNumbers)
End With
for each cell in rng
if cell.Value = 0 then
cell.EntireRow.Hidden = True
else
cell.Entirerow.Hidden = False
end if
Next
 
Back
Top