string convertion to date problem
I would appreciate your help !
I have a string which I convert to date (dd/mm/yyyy), the problem is I
can´t validate that date to check if it is correct.
1) For example, in cell A1 I have the string: 020505
2) With this macro I convert it to date:
ActiveCell.FormulaR1C1 = _
"=DATE(VALUE(RIGHT(RC[-1],2))+2000,VALUE(MID(RC[-1],3,2)),VALUE(LEFT(RC[-1],2)))"
3) In this example, the output is 02/05/05, which is correct.
MY PROBLEM: if my string is 334455 my fórmula returns 02/09/2058
It seems that the formula always returns a date, even in this case
where day is 33 and month is 44.
How can I validate to check if my string can be converted to a correct
date? The solution must consider that some months have 30 days and
others 31 !
Thank you for your help !
|