ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   more help with a hide macro (https://www.excelbanter.com/excel-programming/285161-more-help-hide-macro.html)

Awoll

more help with a hide macro
 
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



Tom Ogilvy

more help with a hide macro
 
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

--
Regards,
Tom Ogilvy

"Awoll" wrote in message
...
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





Awoll

more help with a hide macro
 
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?


"Tom Ogilvy" wrote in message
...
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

--
Regards,
Tom Ogilvy

"Awoll" wrote in message
...
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







Tom Ogilvy

more help with a hide macro
 
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

--
Regards,
Tom Ogilvy

"Awoll" wrote in message
...
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?


"Tom Ogilvy" wrote in message
...
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

--
Regards,
Tom Ogilvy

"Awoll" wrote in message
...
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










All times are GMT +1. The time now is 02:58 PM.

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