View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
PCLIVE PCLIVE is offline
external usenet poster
 
Posts: 1,311
Default Looping over a worksheet

One way:

Sub Macro2()
For Each cell In Range("M1:M100")
If cell.Value = "POUT" _
Then
GoTo Bypass
Else
If cell.Value = "DIFF" _
Then
GoTo Bypass
Else
cell.EntireRow.Hidden = True
End If
End If
Bypass:
Next cell

End Sub


Regards,
Paul


wrote in message
oups.com...
Hello. I'd like to loop over all rows in a worksheet, and hide those
matching certain criteria.

The criteria a
1. Cell in column 'H' equals "PASS"
2. Cell in column 'M' contains the strings "POUT" and "DIFF"

I have so far:

Sub show_diffs()
'
' Hide all rows except those showing POUT and DIFF
' except for rows with FAIL
'
Application.Goto Range("A2")
ActiveCell.EntireRow.Select
Do While ActiveCell.Value < ""
if selection ????????
Selection.EntireRow.Hidden = False
ActiveCell.Offset(1, 0).EntireRow.Select
Loop
End Sub

Thanks.

Stephen