Time format behaviour

K

K Dales

You are only setting the value of the cell, not the
format. So when you put the value "0845" into a cell, just
like if you typed it in that way, Excel sees it as a
regular number, not a special time format, and turns it
into 845 (eight hundred forty five).

You need to paste the actual time value (DepTime) into the
cell and then set the cell's format:

Worksheets("Sheet2").Cells(PasteRow, 16) = DepTime
Worksheets("Sheet2").Cells(PasteRow, 16) = NumberFormat
= "hhmm"

K Dales
 
Top