How do I only display the rows when a specific background colour appears in any cell across multiple columns

I have a several rows in my Microsoft Excel 2010 worksheet and many columns. There is a Red background colour that appears on random cells and I want to create a way to only show those rows where there is at least one cell with a Red background colour.

Sample (The word "Red" represent the background colour of the cell):

Column:      A          B           C          D         E  .... AZ      (column range can go up to column AZ)
Row1   :      Red                                            Red
Row2   :                                      
Row3   :
Row4   :                                Red

So on a new Worksheet  I would like to see with the following output with the rows without any background colour not being shown:

Column:      A          B           C          D         E  .... AZ
Row1   :      Red                                            Red
Row2   :                                Red

If a new function is required to do this type of filtering, I do not mind creating a module in the Workbook for this to work.

Many thanks in advance
ihatelagAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rob HensonFinance AnalystCommented:
What is creating the red background? Conditional Formatting, or random cell filling?

If it is conditional then you could probably create a helper column to check for the condition and then filter on that.
0
Wayne Taylor (webtubbs)Commented:
If coloured manually, you will still need a helper column. The below function can be used in that column and checks every cell in the selected range, which will be in your case the row of data, and will return TRUE if any cell in that range contains a cell with a RED background.

Public Function HasRed(rng As Range) As Boolean    
    Dim cell As Range
    For Each cell In rng
        If cell.Interior.Color = vbRed Then
            HasRed = True
            Exit For
        End If
    Next    
End Function

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ihatelagAuthor Commented:
Thank you so much, you are a genius Wayne!
0
ihatelagAuthor Commented:
Brilliant!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.