Is ther a way to change the interior.colorindex of multiple rows

S

sdnicsm

Is there a way to change the colorindex of rows based upon the result o
a vba find then collapse the ones that are not results of the find??
Ex:

toy1234
toy2
toy1 is cool
toy3
toy4
toy1 is nerdy

All of the rows to changeinterior color are the ....toy1*
then hide the rest. Seems easy but I haven't gotten it to work.

thnx
sdnics
 
B

Bob Phillips

Here's one way

Dim cRows As Long

With ActiveSheet
.Range("A1").EntireRow.Insert
cRows = .Cells(Rows.Count, "A").End(xlUp).Row
.Columns("A:A").AutoFilter Field:=1, Criteria1:="=toy1*",
Operator:=xlAnd
.Rows("2:" &
cRows).SpecialCells(xlCellTypeVisible).EntireRow.Interior.ColorIndex = 35
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top