在Excel VBA中将分钟数加到时间(hh:mm) [英] Add minutes to a time (hh:mm) in excel vba
本文介绍了在Excel VBA中将分钟数加到时间(hh:mm)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在制定生产计划,并想补充一下.到时间前78分钟.VBA中的7:05(am).我将如何去做呢?到目前为止,这是我尝试过的操作,但出现错误13 type:mismatch
I am making a production schedule, and would like to add ex. 78 minutes to a time ex. 7:05 (am) in VBA. How would I go about doing this? This is what I have tried so far, but I'm getting an error 13 type:mismatch
Dim TUntilPump As Integer
Dim TFPump As Long, TStartPump As Long
TUP = 78
TFP = Time(0, TUP, 0)
TSP = Time(7,05,0) + TFP
我认为这与我的可变尺寸或时代格式有关,但我不知道我在做什么错.感谢您的任何帮助,并在此先感谢您!
I'm thinking it has something to do with my variable dimensions or the format of my times, but I have no idea what I'm doing wrong. Any help is appreciated, and thanks in advance!
推荐答案
使用 DATEADD 函数:
TRP = dateadd("n",78,"7:05:00")
"n"表示分钟.
这篇关于在Excel VBA中将分钟数加到时间(hh:mm)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文