How to format a cell in Excel 2010 and back to a date value?

I use a cell format 00"-"00"-"00 to input a "date" like 030271
(3 febr. 1971) But the cell does not contain a date using this method. What code can I use with VBA to convert this cell to the proper date value? It's not a problem if the result will be put in a different cell.

Thnx Remco
pr0fierAsked:
Who is Participating?
 
Swapnil NirmalManager, Audit AnalyticsCommented:

mydate = format("myvalue", "DDMMYYYY")
0
 
pr0fierAuthor Commented:
in my example 030271 this wil return 16111982 ??
0
 
Patrick MatthewsCommented:
Just use a custom number format of:

ddmmyy

and enter your date normally.
0
 
Rory ArchibaldCommented:
If you can use an adjacent cell, you can just use a formula:
=TEXT(A1,"00-00-00")+0
for example.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.