Need to know what is wrong with this 3 line code (row hiding with conditional formati

T

Turquoise_dax

I wish for this macro to hide every rows whch contains "info" in colum
B, but when I push the button associated with it, all rows become
hidden. Any1 can help me with this?


ActiveSheet.Columns("B").Select
Selection.AutoFilter Field:=1, Criteria1:="info"
Selection.EntireRow.Hidden = Tru
 
D

Die_Another_Day

The rows that are filtered are still selected. Therefore when you hide
selection you hide everything. Try this:

Sub HideRows
Dim cell as range
for each cell in Range("B:B")
if cell = "info" then Rows(cell.row).Hidden = True
next
end sub

HTH

Die_Another_Day
 
T

Turquoise_dax

This works fine to hide. However, I also have a "show all" button and i
does not work after. Here is the (very short) code:

Rows("1:100").Select
Selection.EntireRow.Hidden = False

When clicking, it does not unhide rows previously hidden (and in th
range 1-100
 
D

Die_Another_Day

I'm not sure why that doesn't work. This seems to work for me:
Rows("1:100").Hidden = False

HTH

Die_Another_Day
 
T

Turquoise_dax

The row number are now all blue. What does it mean, and could it be
indicative of the problem?
 

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