poorwallace
Active Member
- Joined
- Mar 8, 2005
- Messages
- 365
Hello all....I've got a question about comparing 2 dates. The problem is that the date is contained within a cell in this format:
NNGGQ 12/21/2005
I'm trying to compare the date in the right of the cell to the date in another cell using this:
From the immediate window, I'm getting this:
I suspect the problem is that Range G1 is formatted as a date, while the Right(Cells...) bit is returning text. I could create another cell to output the results of the Right(Cells), but I'd like to see if anyone has an easier solution.
Thanks
NNGGQ 12/21/2005
I'm trying to compare the date in the right of the cell to the date in another cell using this:
Code:
If Right(Cells(4, 4), 8) = Range("G1") Then
MsgBox "It's today!"
ElseIf Right(Cells(4, 4), 8) <> Range("G1") Then
MsgBox "It's not today!"
End If
From the immediate window, I'm getting this:
Code:
?Right(Cells(4, 4), 8)
12/21/05
?Range("G1")
12/21/2005
I suspect the problem is that Range G1 is formatted as a date, while the Right(Cells...) bit is returning text. I could create another cell to output the results of the Right(Cells), but I'd like to see if anyone has an easier solution.
Thanks