Cell colour when filtering

Tefleon

New Member
Joined
Sep 21, 2007
Messages
23
Hi Experts.

This could be standard functionality that I'm missing rather than VBA or some wonderful macro and therefore I apologise in advance if I've missed something.

I have a worksheet...
In row 1 I have my column headers.
In row 1 I have column filters. The standard ones in Excel 2007: data > filters
In the other rows I have my data.

The filtering works as I expect and fine for what I need.

What I'm after is a way to change the background colour of any heading where I've applied the filter.

Example.

Cell A1.
This is a name column where I can filter by first name. If I've applied the filter to this column then cell A1 should format red. When I cancel the filter it should return it the previous format. The formatting of the column data should not be affected.

I can and do filter multiple columns for the same query so would need to be able to see which on my columns are filtered at any time.

Is this standard functionality and if not, how do I create it??

Thanks!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You can use this custom function:

Code:
Function FilterOn(Rng As Range) As Boolean
    Dim x As Integer
    Application.Volatile True
    Set Rng = Rng.Cells(1, 1)
    If Rng.Parent.AutoFilterMode = False Then
        FilterOn = False
        Exit Function
    End If
    With Rng.Parent.AutoFilter
    If Application.Intersect(Rng, .Range) Is Nothing Then
        FilterOn = False
        Exit Function
    End If
    x = Rng.Column - .Range.Cells(1, 1).Column + 1
    FilterOn = .Filters(x).On
    End With
End Function

In conditional formatting formula is:

=FilterOn(A1)
 
Upvote 0

Forum statistics

Threads
1,216,872
Messages
6,133,173
Members
449,784
Latest member
n64kps

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