So at the plant I work at we have an action plan list that is constantly being shared by all of management. The issue is some people will Filter a column to find items that pertain to them or their department. Then the next person will jump into the document and not realize that a specific column is being filters and will assume the information they are seeing is the entire document. How do i go about highlighting the filtered cell so its obvious to the next user?
The current code I found from https://excelribbon.tips.net/T013410..._a_Filter.html
Sub ColorFilterColumn()
Dim flt As Filter
Dim iCol As Integer
Dim lRow As Long
Dim rTemp As Range
Dim bFullCol As Boolean
' Set as True if you want entire column shaded
bFullCol = False
If ActiveSheet.AutoFilterMode Then
iCol = ActiveSheet.AutoFilter.Range.Column
lRow = ActiveSheet.AutoFilter.Range.Row
Application.EnableEvents = False
For Each flt In ActiveSheet.AutoFilter.Filters
If bFullCol Then
Set rTemp = Cells(lRow, iCol).EntireColumn
Else
Set rTemp = Cells(lRow, iCol)
End If
If flt.On Then
rTemp.Interior.Color = vbYellow
Else
rTemp.Interior.ColorIndex = xlColorIndexNone
End If
Set rTemp = Nothing
iCol = iCol + 1
Next flt
Application.EnableEvents = True
End If
End Sub
Bookmarks