【问题标题】:Display number of hours [duplicate]显示小时数[重复]
【发布时间】:2016-08-29 01:34:22
【问题描述】:

我一直在尝试找到一种方法来在列表框中显示时间 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.

【问题讨论】:

  • 上次你问的时候我在 cmets 里回答了这个问题:把格式改成“[h]:mm”。
  • 不起作用@DougGlancy 我也在尝试这个; tiempoa = .Offset(, -18).Value tiempob = 现在 tiempoc = DateDiff(hhh, tiempoa, tiempob) Data(i, 5) = tiempoc

标签: vba time listbox


【解决方案1】:

我想通了。

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

Data(i, 5) = tiempoc

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-03
    • 2020-05-10
    • 1970-01-01
    • 2021-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多