Sub FilterByColor()
Dim r As Range, txt As String
Dim fColor As Byte
fColor = Range("B1").Interior.ColorIndex
Columns(1).Rows.Hidden = False
Again:
For Each r In Range("a2", Range("a" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
If r.Interior.ColorIndex <> fColor Then txt = txt & r.Address(0, 0) & ","
If Len(txt) > 245 Then
Range(Left(txt, Len(txt) - 1)).EntireRow.Hidden = True
txt = Empty: GoTo Again
End If
Next
If Len(txt) Then Range(Left(txt, Len(txt) - 1)).EntireRow.Hidden = True
End Sub