You can certainly add a caveat. I fear I may have misjudged your requirement though. If you require the colouring to be 'live' so to speak, you will need to determine what should trigger the changes. I suspect the Workbook_Open event would also be necessary. To that end, add this code to a normal module:
Sub colourDates(DateRange As Range)
Dim cell As Range
On Error GoTo catch
Application.EnableEvents = False
For Each cell In DateRange.Cells
If IsDate(cell.Value) Then
If cell.Value < Date - 90 And LCase$(cell.Offset(, 1).Value) <> "do not contact" Then
cell.Offset(, 1).Value2 = "Cold"
End If
End If
Next cell
catch:
Application.EnableEvents = True
End Sub
You may then alter the earlier Worksheet_Change code to simply this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("E:E")) Is Nothing Then
colourDates Intersect(Target, Range("E:E")).Cells
End If
End Sub
and lastly change the Workbook_Open code to use the new routine as well:
Private Sub Workbook_Open()
Dim lastRow As Long
Sheets("SalesLog").Visible = True
Sheets("Orders").Visible = True
Sheets("Reporting").Visible = True
Sheets("Settings").Visible = xlHidden
Sheets("DataBase").Visible = True
Sheets("Trends").Visible = True
Sheets("Compare").Visible = True
Sheets("Trend Data").Visible = xlHidden
Sheets("Client File").Visible = True
Sheets("Reporting").Activate
Sheets("Warning").Visible = xlVeryHidden
With Sheets("Database")
If .AutoFilterMode Then
If .FilterMode Then .ShowAllData
End If
lastRow = .Cells(.Rows.Count, "E").End(xlUp).Row
colourDates .Range("E5:E" & lastRow)
End With
End Sub
Bookmarks