Thread: Comparing dates
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] nectarinesupreme@gmail.com is offline
external usenet poster
 
Posts: 13
Default Comparing dates

Hi, I'm trying to compare dates in a macro and I think I just need to
be the told the correct format. Currently I have

If (DateValue(testdate) = DateValue("5 / 1 / 2007")) Then
cellSTBpaste = "Y" & ActiveCell.Row
cellorderpaste = "X" & ActiveCell.Row
Else
cellSTBpaste = "AB" & ActiveCell.Row
cellorderpaste = "AA" & ActiveCell.Row
End If

where testdate is a formatted date taken from a cell in the
spreadsheet. Could someone tell me the correct way to do it?

Thanks!