Hi everyone,
I have an array of dates and I'm trying to search for dates that are more than 2 years old but I can get the dateadd to work with the search loop. can anybody tell me why the code isn't working please.
Private Sub Workbook_Open()
With Sheets("Sheet1")
Dim due As Range
Dim i As Long, j As Long
Set due = Range("H24:AJ68")
For i = 1 To due.Rows.Count
For j = 1 To due.Columns.Count
If DateAdd("YYYY", 2, due.Cells(i, j).Value) < Date Then
due.Cells(i, j).Font.ColorIndex = 3
Else
due.Cells(i, j).Font.ColorIndex = 1
End If
Next j
Next i
End With
End Sub
Thanks
Bookmarks