I am trying to copy a cell containing a time to another using .value but this results in a decimal!
Try running this on your computer:
Cells(1, 1).Value = "18:00"
Cells(1, 2).Value = Cells(1, 1).Value
In the first cell, the value is 18:00, but the value in the second cell is 0.75! (=18/24 perhaps?)
Can anybody explain why this happens? Is there is a way to copy the time correctly?
I know that a copy-and-paste will get round this, but I do not want to it because it will transfer all the formatting from my source cell to my target cell.
I think the answer is something very simple and I apologise if I have asked a stupid question, but I tried looking for the answer on the internet but found nothing.
Many thanks.
Try running this on your computer:
Cells(1, 1).Value = "18:00"
Cells(1, 2).Value = Cells(1, 1).Value
In the first cell, the value is 18:00, but the value in the second cell is 0.75! (=18/24 perhaps?)
Can anybody explain why this happens? Is there is a way to copy the time correctly?
I know that a copy-and-paste will get round this, but I do not want to it because it will transfer all the formatting from my source cell to my target cell.
I think the answer is something very simple and I apologise if I have asked a stupid question, but I tried looking for the answer on the internet but found nothing.
Many thanks.