View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Need to know what is wrong with this 3 line code (row hiding with conditional formati

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

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


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


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=553660