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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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