VBA highlight filtered column (top row only)

MichaelRSnow

Active Member
Joined
Aug 3, 2010
Messages
409
I have located this code which highlights the whole column and changes all other columns to colour blank, is there a way of adjusting this so it only applies it to the top row (row 1) and not the whole column?

Any help would be much appreciated

Code:
[COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] Worksheet_Calculate() 
    ColorAutoFilter 
[COLOR=blue]End Sub[/COLOR] 

[COLOR=blue]Sub[/COLOR] ColorAutoFilter() 
    [COLOR=blue]Dim[/COLOR] FilterNum [COLOR=blue]As[/COLOR] [COLOR=blue]Long[/COLOR] 
    [COLOR=blue]With[/COLOR] ActiveSheet 
        [COLOR=blue]If[/COLOR] .AutoFilterMode [COLOR=blue]Then[/COLOR] 
            [COLOR=blue]For[/COLOR] FilterNum = 1 [COLOR=blue]To[/COLOR] .AutoFilter.Filters.Count 
                [COLOR=blue]If[/COLOR] .AutoFilter.Filters(FilterNum).On [COLOR=blue]Then[/COLOR] 
                    .AutoFilter.Range.Columns(FilterNum).Interior.ColorIndex = 6 [COLOR=darkgreen]'yellow[/COLOR]
                [COLOR=blue]Else[/COLOR] 
                    .AutoFilter.Range.Columns(FilterNum).Interior.ColorIndex = xlNone 
                [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] 
            [COLOR=blue]Next[/COLOR] 
        [COLOR=blue]Else[/COLOR] 
            .Cells.Interior.ColorIndex = xlNone 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] 
    [COLOR=blue]End With[/COLOR] 
[COLOR=blue]End Sub[/COLOR]
 
So, the code above highlights the columns that are being filtered on but, I want to highlight the row that is being filtered and then unfilter but leave the row colored and all other rows not colored
 
Upvote 0

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