LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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 !

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date convertion O.C Excel Discussion (Misc queries) 2 April 24th 06 01:45 PM
Convertion bach New Users to Excel 6 September 1st 05 07:55 PM
.wb3 file convertion rogersat Excel Worksheet Functions 0 July 18th 05 05:40 AM
CONVERTION $750 TO WORDS victory New Users to Excel 1 December 23rd 04 08:39 AM
Convertion to Hex Alain[_2_] Excel Programming 3 September 23rd 03 07:46 PM


All times are GMT +1. The time now is 01:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"