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
Who is Participating?
Swapnil NirmalManager, Audit AnalyticsCommented:

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


and enter your date normally.
Rory ArchibaldCommented:
If you can use an adjacent cell, you can just use a formula:
for example.
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.