View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Dates exported as text

Hi
Excel doesn't like the th or rd in 24th or 23rd.
In VBA you could try

Public Sub test()
With Application.WorksheetFunction
Range("C1").Value =
Format(DateValue(.Substitute(.Substitute(Range("A1 "), "th", ""), "rd",
"")), "dd/mm/yy")
End With
End Sub

mind the line wrap. Your original date is in A1.

In Excel try
=DATEVALUE(SUBSTITUTE(SUBSTITUTE(A1, "th", ""), "rd", ""))

in cell C1, say, where C1 has the general cell format. Now change the
cell format to date and choose the format you require

regards
Paul