Solved

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

Posted on 2011-09-24
5
178 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:pr0fier
5 Comments
 
LVL 11

Expert Comment

by:Swapnil Nirmal
ID: 36593178

mydate = format("myvalue", "DDMMYYYY")
0
 

Author Comment

by:pr0fier
ID: 36593317
in my example 030271 this wil return 16111982 ??
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36593328
Just use a custom number format of:

ddmmyy

and enter your date normally.
0
 
LVL 8

Accepted Solution

by:
wchh earned 250 total points
ID: 36597063
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 36597549
If you can use an adjacent cell, you can just use a formula:
=TEXT(A1,"00-00-00")+0
for example.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question