Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel VBA-带小时和分钟的截止日期?_Excel_Vba_Date_Time - Fatal编程技术网

Excel VBA-带小时和分钟的截止日期?

Excel VBA-带小时和分钟的截止日期?,excel,vba,date,time,Excel,Vba,Date,Time,假设我想在离事情发生还有一个小时的时候弹出一个msgbox,怎么做 我在想一些类似的事情: MyLimit = Now If .Value = MyLimit Then msgbox "Do that thing cause it is due right now" 或 并使公式引用日期格式为“m/d/yy h:mm AM/PM”的单元格 类似的方法不起作用,我想知道为什么。试试Application.OnTime方法 Sub setAlarm() Application.OnTim

假设我想在离事情发生还有一个小时的时候弹出一个msgbox,怎么做

我在想一些类似的事情:

MyLimit = Now

If .Value = MyLimit Then
msgbox "Do that thing cause it is due right now"

并使公式引用日期格式为“m/d/yy h:mm AM/PM”的单元格


类似的方法不起作用,我想知道为什么。

试试Application.OnTime方法

Sub setAlarm()
    Application.OnTime Range("deadline").Value - TimeValue("01:00:00"), "my_Procedure"
End Sub

Sub my_Procedure()
    MsgBox "Do that thing cause it is due right now"
End Sub

msgbox在截止日期前一个小时弹出

谢谢,我明天回去工作后会测试它,并告诉你它是否可以:)看起来不错,我不知道这种方法。
Sub setAlarm()
    Application.OnTime Range("deadline").Value - TimeValue("01:00:00"), "my_Procedure"
End Sub

Sub my_Procedure()
    MsgBox "Do that thing cause it is due right now"
End Sub