VBA Filter by Color /show all row having one colored cell

nyounaki

New Member
Joined
Nov 9, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
HI ,
I am having around 15 Columns A,B,C,D,....etc.
I am looking for function to filter rows by color by showing "all rows if one -at least- of their cells has a red color (like Red background ) , can you please help ?
Thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try:

VBA Code:
Sub hidecolouredcellrows()

Dim ws As Worksheet

Set ws = ActiveSheet

For Each cell In ws.UsedRange
    If cell.Interior.Color = vbRed Then
    Rows(cell.Row).Hidden = True
    End If
Next cell
  
End Sub
 
Upvote 0
Try:

VBA Code:
Sub hidecolouredcellrows()

Dim ws As Worksheet

Set ws = ActiveSheet

For Each cell In ws.UsedRange
    If cell.Interior.Color = vbRed Then
    Rows(cell.Row).Hidden = True
    End If
Next cell
 
End Sub
 
Upvote 0
HI I have more than 1K Records, is taking very long time to execute this function more than 20 minutes, is there other way in VBA like using advanced filter functions in VBA?
 
Upvote 0

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

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