Filter by background color?

Dorothychin

Board Regular
Joined
Oct 7, 2002
Messages
130
Is it possible to filter a column by background color? Eg. there are certain rows in column A are background colored in yellow, is it possible to view only the yellow cell in column A?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Filter by background colour

Hi

If you have conditional formatting for the background colour, then you can filter on the same conditions

Hope this helps
 
Upvote 0
Hi,

Code:
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

Fill the filter color in b1 and run the macro.

Thanks to jindon.
 
Upvote 0

Forum statistics

Threads
1,223,838
Messages
6,174,942
Members
452,593
Latest member
Jason5710

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top