Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Date_Errors()
- Dim MyRng As Variant
- Set MyRng = ActiveSheet.Range("A2", "A4")
- For Each cell In MyRng
- If IsDate(cell) Then ' make sure the cell has a date
- If cell.Value < Date Then
- MsgBox ("Before")
- ElseIf (cell.Value - 1) < Date Then
- MsgBox ("Older")
- End If
- Else
- MsgBox ("Not a date")
- End If
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement