2016-08-29 37 views
-4

我一直在試圖找到一種方法來顯示列表框中的時間a和時間b之間的小時數,即使那是幾百小時。 注意:tiempoa與「現在」一起被採取,顯然在時間b之前。顯示小時數

Dim tiempoa As Date 
Dim tiempob As Date 
Dim tiempoc As Date 

tiempoa = .Offset(, -18).Value 
tiempob = Now 
tiempoc = Format(tiempoa - tiempob, "hh:mm") 

Data(i, 5) = tiempoc 

This is whats displayed, even it showld be around 80 hours.

+0

我回答了你上次提問時的評論:將格式更改爲「[h]:mm」。 –

+0

不工作@DougGlancy 我也試過這個; tiempoa = .Offset(,-18)。價值 tiempob =現在 tiempoc =則DateDiff(HHH,tiempoa,tiempob) 數據(I,5)= tiempoc –

+0

我添加了一個圖像 –

回答

1

我已經想通了。

tiempoa = .Offset(, -18).Value 
    tiempob = Now 
    tiempoc = DateDiff("h", tiempoa, tiempob) 

Data(i, 5) = tiempoc