Filter by Cell Color

bino1121

New Member
Joined
Apr 26, 2023
Messages
14
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
Platform
  1. Windows
Trying to auto filter sheet2 by color for cells with no fill then change the color of the filtered cells with no fill to green range for sheet 2 column A is variable so it needs to incorporate an xlDown/up so that if the range changes it'll still select all the values.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Others may be able to understand the scope of your request but without knowing more I cannot assist. Consider posting a link to your workbook so someone willing to assist does not have to create a fake one to work with. Use the link icon at the top of the message area.
 
Upvote 0
Best if you could post your sheet using the XL2BB - Excel Range to BBCode. However, see if this does what you want:
VBA Code:
Option Explicit
Sub bino1121()
    Application.ScreenUpdating = False
    Dim ws As Worksheet, r As Range
    Set ws = Worksheets("Sheet2")
    Set r = ws.Range("A1:A" & ws.Cells(Rows.Count, "A").End(xlUp).Row)
    
    With r
        .AutoFilter 1, Operator:=xlFilterNoFill
        .Offset(1).Resize(.Rows.Count - 1).Interior.Color = vbGreen
        .AutoFilter
    End With
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,226
Messages
6,129,605
Members
449,520
Latest member
TBFrieds

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