View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Modeste Modeste is offline
external usenet poster
 
Posts: 4
Default Date Conversion Help

Bonsour® Saucer Man avec ferveur ;o))) vous nous disiez :

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


suppose your date datas are in column C :
only for the dates :

Columns("C:C").Select
Selection.TextToColumns Destination:=Range("C1"), DataType:=xlFixedWidth, _
OtherChar:="#", FieldInfo:=Array(Array(0, 9), Array(2, 5), Array(10, 9)), _
TrailingMinusNumbers:=True

for dates and times détails :
Warning Insert 3 columns before column "D"
(to prevent overwritting existing other datas)

Columns("C:C").Select
Selection.TextToColumns Destination:=Range("C1"), DataType:=xlFixedWidth, _
OtherChar:="#", FieldInfo:=Array(Array(0, 9), Array(2, 5), Array(10, 1), Array(12 _
, 1), Array(14, 1), Array(16, 1)), TrailingMinusNumbers:=True

;o)) Assume your know how to correct time reconstruction...

cheers !