Date parsing - how to get same result from different input types?

Joined
Jun 24, 2009
Messages
2
Reaction score
0
Hi guys,

I have many kinds of date types as an input for parsing and many international settings where this macro has to run.
E.g. date can be put as "24-03-2009" or "16-aug-09" or whatever and default date setting on user's computer can not be predicted.

Need to parse a date and always get the result in one specific format, chosen by myself.
It has to be independent on MY excel date settings and I can not change the source sheet.

I can use value2 to get the "absolute value" of the date but I need to retype it back to date before the parsing.

How can I make vba to STORE the date (in a variable not connected to any cell on the sheet) in specific format for the parsing purposes?

Thank you, any idea is much appreciated.
Zuzana
 
Joined
Jun 24, 2009
Messages
2
Reaction score
0
So that's the solution:

(dateToBeParsed as string)

dateToBeParsed = sourceCell.Value
dateToBeParsed = Format(dateToBeParsed, "dd/mm/yyyy")

now the dateToBeParsed is in my format.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top