How to search for last occurrence of a DateTime in a string using VBA?
For example, given the below sample:
In my sample below, in column A, there are notes that have a DateTime stamp. I need to get the last occurrence of dateTime. If only the notes only contains 1 datetime, then I need to get that. The expected output is in Column B.
I tried to get the dateTime but it is getting the 1st occurrence. See my codes below:
Sub test()
For x = 1 To Cells(Rows.Count, 1).End(xlUp).Row
Cells(x, 2).Value = Left(Cells(x, 1).Value, 19)
Cells(x, 2).Select
Selection.NumberFormat = "yyyy-mm-dd hh:mm:ss"
Next x
End Sub