So I tried the macro below on a new data set and it looks like if the filter does not include data the header row is colored.
Please see my attachment. Any help/guidance would be greatly appreciated. First tab shows what the data is like post-macro and second tab is the ideal outcome. I believe it may have something to do with the portion End(3)?
Sub Colorrowbydate()
Dim x As Date
x = Date + 90
With ActiveSheet
'If expiration date is equal to or less than 90 days from today's date then Yellow
.Range("A1:BK1").AutoFilter Field:=14, Criteria1:="<" & x
.Range("N2:N" & .Range("N" & Rows.Count).End(3).Row).EntireRow.Interior.Color = RGB(255, 255, 204)
.AutoFilterMode = False
'If expiration date is less than today's date then Red
.Range("A1:BK1").AutoFilter Field:=14, Criteria1:="<" & Date
.Range("N2:N" & .Range("N" & Rows.Count).End(3).Row).SpecialCells(12).EntireRow.Interior.Color = RGB(230, 184, 183)
.AutoFilterMode = False
'If expiration data is greater than 90 days from today's date then Green
.Range("A1:BK1").AutoFilter Field:=14, Criteria1:=">" & x
.Range("N2:N" & .Range("N" & Rows.Count).End(3).Row).SpecialCells(12).EntireRow.Interior.Color = RGB(213, 226, 184)
.AutoFilterMode = False
End With
End Sub
Bookmarks