Text>Date ???

  • Thread starter Thread starter silentpro
  • Start date Start date
S

silentpro

I have a workbook that has multiple sheets & each one has a date field.
Someone entered the dates in a non xl date format

Example: January 6 2009

I tried formatting the whole column to show d/m/yy but the text example
above doesn't format.

Is there a macro or something that I can run to convert these text dates to
an actual date format?


Thanks
 
I think this macro will do what you want (just change the sheet name and
cell range in the For Each statement to match your actual conditions)...

Sub MakeNearDatesRealDates()
Dim C As Range
For Each C In Worksheets("Sheet1").Range("C:C")
If TypeName(C.Value) <> "Date" Then
If IsDate(C.Value) Then C.Value = CDate(C.Value)
End If
Next
End Sub
 
Perfect, thank you very much!!!!


Rick Rothstein said:
I think this macro will do what you want (just change the sheet name and
cell range in the For Each statement to match your actual conditions)...

Sub MakeNearDatesRealDates()
Dim C As Range
For Each C In Worksheets("Sheet1").Range("C:C")
If TypeName(C.Value) <> "Date" Then
If IsDate(C.Value) Then C.Value = CDate(C.Value)
End If
Next
End Sub
 
Back
Top