Subject: check dates against each other from differentrange
Posted By: crmpicco Post Date: 12/19/2005 5:49:45 AM


'... if the cells are not empty then change the number format '... to the date format DD MMM YY If Range(sRange).Text <> "" Then Range(sRange).NumberFormat = "dd mmm yy" End If If Range(sTempRange).Text <> "" Then Range(sTempRange).NumberFormat = "dd mmm yy" End If



Is there a way to check if the text/value inside sTempRange is not earlier than the text/value inside sRange??

For e.g. I have a problem in my sheet as sRange = 29-Dec-05 and sTempRange = 31-Mar-05.

Can i do a check or something for this?

Thanks.

Picco

www.crmpicco.co.uk
Reply By: shattered Reply Date: 12/19/2005 10:26:00 AM
depends on how the data is stored - if its in date format then its a simple case of comparing one date to the other

With Sheets("Sheet1")
    If .Cells(2, 2).Value < .Cells(2, 3).Value Then
        .Cells(2, 4).Value = "Before"
    Else
        .Cells(2, 4).Value = "After"
    End If
End With

if its stored purely as text then its a case of parsing the text and then passing it as a date before doing the comparison



Go to topic 37749

Return to index page 414
Return to index page 413
Return to index page 412
Return to index page 411
Return to index page 410
Return to index page 409
Return to index page 408
Return to index page 407
Return to index page 406
Return to index page 405