PDA

View Full Version : Hide Rows based several values



agnesz
10-01-2007, 08:30 AM
I need to hide a row if any of the rows 195 through 796 in column I contains any of the following words:
Mike
Sunny
Patti
Dennis, etc.
Please help!
Thank you,
az

Bob Phillips
10-01-2007, 08:44 AM
Sub ProcessData()
Dim i As Long
Dim ary

Application.ScreenUpdating = False

ary = Array("Mike", "Sunny", "Patti", "Dennis")

For i = 796 To 195 Step -1

If Not IsError(Application.Match(Cells(i, "I").Value, ary, 0)) Then
Rows(i).Delete
End If
Next i

Application.ScreenUpdating = True
End Sub

agnesz
10-01-2007, 10:08 AM
I just want to hide the row though, not delete it...
Can you adjust the code?
thanks so much!

Bob Phillips
10-01-2007, 10:14 AM
Rows(i).Hidden = True