Date Conversion Help
Saucer man,
Perhaps:
Dim strDate As String
Dim myDate As Date
strDate = "##20090520123345"
myDate = DateSerial(Mid(strDate, 3, 4), Mid(strDate, 7, 2), Mid(strDate,
9, 2))
MsgBox myDate
HTH,
Bernie
MS Excel MVP
"Saucer Man" wrote in message
...
I have a macro which imports a date into one of my excel cells from a .csv
file in a strange format. For example, if the date is 5-20-09, it is
imported in this format...
##20090520123345
I want the macro to change it to...
05/20/09
Currently I am searching the cell and if I find the XX in the first two
positions, I am just replacing the whole string with DATE. The problem is
that the date might be a date other than today.
How can I manipulate and truncate the string once I find the entries that
start with XX? The numbers 12345 in the above example are not constant.
--
Thanks!
|