highlights all dates in the past week:
Sub FormatDatesLastWeek()
With Selection
.FormatConditions.Delete
' DateOperator choices include xlYesterday, xlToday, xlTomorrow,
' xlLastWeek, xlThisWeek, xlNextWeek, xlLast7Days
' xlLastMonth, xlThisMonth, xlNextMonth,
.FormatConditions.Add Type:=xlTimePeriod, DateOperator:=xlLastWeek
.FormatConditions(1).Interior.Color = RGB(255, 0, 0)
End With
End Sub
Related examples in the same category