Filtering rows by what colour they are filled with

Ed in Aus

Well-known Member
Joined
Jul 24, 2007
Messages
829
Is this possible I have tried a few searches and thought I'd try here also
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
"Is this possible"

yes. for a more elaborate answer, provide a more elaborated question :)
 
Upvote 0
I know one way if the colors are due to a conditional format. The least amount of work for you is if you're only dealing with a single column, and the cell values individually trip the condition, and a single formula can represent the condition. (For example, if one column has conditionally formatted red or orange backgrounds on the negative cells.) In that case, just set up a filter on the column and put the same condition as the filter condition (in the example, <0).

If that's unwieldy, you could add a column, which with ORs could even handle several distinct conditions, and filter that column. It can even be a hidden column (hide it after you've set it up).

If you're lucky and everything falls into place, you could alter the filter condition and then get one color at a time. For example you might set the filter condition to >0 for reds, 0 for yellows, or "Southern" for blue. It just depends on what you have.

Failing that you can just brute-force it using VBA and hiding rows (or columns) checking .Interior.color and checking it against ActiveWorkbook.Styles.Application.Cells.Interior.Color; but in this case, conditional formats are your enemy and require a lot more code.
 
Upvote 0
I dont want it for numbers it more the whole row that is color ie a payroll report with certain people highlighted to investigate... surely someone must have made a bit of code for this.
 
Upvote 0
Code:
Sub HideUncoloredRows()
Dim c As Range
  For Each c In Application.Intersect(Range("A:A"), ActiveSheet.UsedRange)
    If c.Interior.Color = ActiveWorkbook.Styles.Application.Cells.Interior.Color Then
      c.EntireRow.Hidden = True
    End If
  Next c
End Sub
Sub UnHideAllRows()
Dim c As Range
  For Each c In Application.Intersect(Range("A:A"), ActiveSheet.UsedRange)
    If c.EntireRow.Hidden Then c.EntireRow.Hidden = False
  Next c
End Sub
 
Upvote 0
I should suggest that you set a range on the pertinent data (let's say it's ReportData) and add some qualifiers like
if c.row >= range("ReportData").row
so heading and summary rows and such are not obscured.
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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