Potrzebuję pomocy w obliczeniu różnicy czasu między czasami z dwóch różnych dat.
Cell(1,1) contains: 19/06/2016 01:00:00
Cell(1,2) contains: 20/06/2016 02:30:00
Odpowiedź powinna wynosić: 25:30:00 Oto mój kod:
Dim a As Date, b As Date
a = Cells(1, 1).Value
b = Cells(1, 2).Value
Cells(1, 3).Value = TimeValue(b) - TimeValue(a)
Ale ten kod daje mi 1:30:00
Odpowiedzi:
3 dla odpowiedzi № 1Po prostu odejmij:
Sub luxation()
Dim a As Date, b As Date
a = Cells(1, 1).Value
b = Cells(1, 2).Value
Cells(1, 3).Value = b - a
Cells(1, 3).NumberFormat = "[hh]:mm:ss"
End Sub