gpt4 book ai didi

vba - 如何格式化 [h] :mm excel format using format() function in VBA 中的时间

转载 作者:行者123 更新时间:2023-12-01 18:45:47 25 4
gpt4 key购买 nike

是否可以使用 VBA 将时间格式化为 [h]:mm 格式?

[h]:mm 在 Excel 中的格式会将 25 小时显示为 25:00,将 125 小时显示为 125:00

我尝试过一些方法,例如:

format(datetime, "[h]:mm")
format(datetime, "H:mm")
format(datetime, "hh:mm")

这些都没有达到预期的效果。我还浏览了 MS 帮助,但找不到任何有用的内容。

最佳答案

通过应用程序对象使用 TEXT 工作表函数,如下所示:

  x = Application.Text(.294,"[h]:mm")

关于vba - 如何格式化 [h] :mm excel format using format() function in VBA 中的时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11143746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com