Link to home
Start Free TrialLog in
Avatar of pr0fier
pr0fier

asked on

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
Avatar of Swapnil Nirmal
Swapnil Nirmal
Flag of India image


mydate = format("myvalue", "DDMMYYYY")
Avatar of pr0fier
pr0fier

ASKER

in my example 030271 this wil return 16111982 ??
Avatar of Patrick Matthews
Just use a custom number format of:

ddmmyy

and enter your date normally.
ASKER CERTIFIED SOLUTION
Avatar of wchh
wchh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you can use an adjacent cell, you can just use a formula:
=TEXT(A1,"00-00-00")+0
for example.