Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

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