I have Dates and Times in Cols B & D from row 2 onwards
I have tried to write code to move the Times from Col B to C and from Col D to E but cannot get this to work
Kindly test & amend my code
Sub MoveTimeValues()
Dim lastRow As Long
lastRow = Cells(Rows.Count, "B").End(xlUp).Row
'Loop through each row in columns B and D
For i = 2 To lastRow
'Extract the time portion of the date-time value in column B and move it to column C
Cells(i, "C").Value = Format(Cells(i, "B").Value, "hh:mm AM/PM")
'Extract the time portion of the date-time value in column D and move it to column E
Cells(i, "E").Value = Format(Cells(i, "D").Value, "hh:mm AM/PM")
Next i
End Sub
Bookmarks