So I have cells containing strings of date, such as:
14/04/2019 10:13:18 AM
how can I convert it to DateTime using vba?
I've tried using .NumberFormat but some of the cells got converted and some didn't:
My code is
Sub ConvertToDateTime()
With Range("Data[Modified On]")
.NumberFormat = "dd/mm/yyyy hh:mm:ss AM/PM"
.Value = .Value
End With
End Sub
And how do I insert converted value to a new column? I've created a new column with:
Dim Table As ListObject
Dim newColNum As Integer
Set Table = ActiveSheet.ListObjects("Data")
Table.ListColumns.Add.Name = "New Header"
Can I do it without looping?
