How to highlight column or column header if it is filtered in Excel?
For a table with multiple columns, it is not easy to find out which column is filtered at a glance as there is no obvious symbol for the filtered column except for a mark. If you want to make the filtered column outstanding in a table, a method in this article can help you.
Highlight column header or entire column if it is filtered with VBA code
Highlight column header or entire column if it is filtered with VBA code
As below screenshot shown, you need to highlight the entire column or only the column header if this column is filtered in a table range, please apply the following VBA codes.
1. Press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, please click Insert > Module. Then copy the below VBA code into the Module window.
VBA code: Highlight column header if the column is filtered
Sub HighLightTitle()
'Updated by Extendoffice 2017/9/12
Dim xRg As Range
Dim I As Integer
Dim xCount As Long
Dim xRgCol As Long
Dim xAddress As String
Dim xFilterCount As Long
On Error Resume Next
xAddress = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Please select the first cell of the table range:", "KuTools For Excel", xAddress, , , , , 8)
If xRg Is Nothing Then Exit Sub
xRg.Select
With xRg(1).Parent.AutoFilter
xFilterCount = .Range.Columns.Count
xRgCol = xRg.Offset(1).Column - .Range.Column + 1
For I = xRgCol To xFilterCount
xCount = xRg.Offset(, I - xRgCol).Column - .Range.Column + 1
With .Filters(xCount)
If .On Then
xRg.Offset(, I - xRgCol).Interior.Color = 16736553
End If
End With
Next
End With
End Sub
For highlighting entire column if it is filtered in a table, please copy and paste the below VBA code into the Module window.
VBA code: Highlight entire column if it is filtered
Sub HighLightCols()
'Updated by Extendoffice 2017/9/12
Dim xRg As Range
Dim xCount As Long
Dim xRgCol As Long
Dim xAddress As String
Dim xRgFilter As Range
Dim xFilterCount As Long
On Error Resume Next
xAddress = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Please select the first cell of the table range:", "KuTools For Excel", xAddress, , , , , 8)
If xRg Is Nothing Then Exit Sub
xRg.Select
With xRg(1).Parent.AutoFilter
xFilterCount = .Range.Columns.Count
xRgCol = xRg(1).Column - .Range.Column + 1
For I = xRgCol To xFilterCount
xCount = xRg.Offset(, I - xRgCol).Column - .Range.Column + 1
With .Filters(xCount)
Set xRgFilter = xRg.Offset(, I - xRgCol).Parent.AutoFilter.Range.Columns(xCount)
If .On Then
xRgFilter.Interior.Color = 16736553
End If
End With
Next
End With
End Sub
3. Press the F5 key to run the code. In the popping up Kutools for Excel dialog box, please select the first cell of the table you need to highlight the filtered column header or entire filtered column, and then click the OK button.
Then the column header or entire column will be highlighted immediately if the column is filtered in a certain table. See screenshots:
Highlight column header if the column is filtered in the table:
Highlight entire column if it is filtered in the table:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!





