Filter By Rows, Instead of Columns

Guzzlr

Well-known Member
Joined
Apr 20, 2009
Messages
946
Office Version
  1. 2016
Platform
  1. Windows
Hello All,
I often use colored cells to filter by column. For example, column A may have 30 cells colored blue, then i can easily filter by that color to get those particular cells in Column A.
But wonder if I want to do the same filter technique with colored cells, only by Row, instead of by Column.
For example, if Row 2 has some cells colored, then how can i set a filter on Row 2, to just filter for those individual colored cells?
Thanks for the help
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
There is no built-in feature in Excel to filter by rows so you need a macro. This macro assumes that row 2 contains data as well a color fill.
VBA Code:
Sub filterColors()
    Application.ScreenUpdating = False
    Dim lCol As Long, x As Long
    lCol = Cells(2, Columns.Count).End(xlToLeft).Column
    For x = lCol To 1 Step -1
        If Cells(2, x).Interior.ColorIndex = xlNone Then
            Columns(x).Hidden = True
        End If
    Next x
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
You cannot currehtly set an Excel filter to filter on rows based on column content. The current capability is to filter on Columns, based on row content.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,796
Members
449,095
Latest member
m_smith_solihull

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