Sub clearDates()
Dim ws As Worksheet
Dim sel As Range
Dim cel As Range
Dim currDate As Date
Dim prevDate As Date
Dim curr As Date
Dim prev As Date
currDate = Date
prevDate = currDate - 1
curr = DateValue(currDate) + TimeValue("17:00:00")
prev = DateValue(prevDate) + TimeValue("17:00:00")
Set ws = ActiveSheet
Set sel = Selection
For Each cel In sel
If IsDate(cel) Then
If (cel.Value2 < prev Or cel.Value2 > curr) Then
cel.ClearContents
End If
End If
Next
End Sub