PDA

View Full Version : Hide Row if cell has specified word



agnesz
08-03-2007, 12:55 PM
I need to hide any row that (in column I) contains the word Comp, however the cell may also include other words, i.e. "Aspirational Comp", or "Better Comp" and all of these have to be hidden, but only in a specified range from row 300 to the end of the spreadsheet.
Any suggestions?
Thank you,

mvidas
08-03-2007, 01:14 PM
Hi agnesz,

What about using AutoFilter? Create a custom autofilter and have it Show rows where: <column I> does not contain: "comp"

YellowLabPro
08-03-2007, 01:30 PM
Sub Conceal()
Dim i As Long
Dim lastrow As Long
Dim c As Range
Dim rng As Range
lastrow = Cells(Rows.Count, "I").End(xlUp).Row
For i = 300 To lastrow
If Cells(i, "I").Text = "Comp" Or Cells(i, "I").Text = "Aspirational Comp" _
Or Cells(i, "I").Text = "Better Comp" Then
Cells(i, "I").EntireRow.Hidden = True
End If
Next i
End Sub


edited for details' 4:49pm