|
本帖最后由 jychg 于 2009-7-11 22:07 编辑
c5输入公式然后向下复制到c8:=IF(($B$3+SUM($B$5:B5)/1440-$C$3)>0,$B$3+SUM($B$5:B5)/1440-$C$3+$B$3+1,$B$3+SUM($B$5:B5)/1440)
b10输入公式:=(OFFSET(E5,MATCH(NOW(),E5:E8,1),0)-NOW())*1440
thisworkbook中插入代码:
Private Sub Workbook_Open()
k = True
OntimeRun
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
k = False
End Sub
插入模块代码:
Option Explicit
Public k As Boolean
Sub OntimeRun()
Sheet1.Calculate
MsgBox "离当前任务结束时间" & Sheet1.Range("B10").Value
If k = True Then
Application.OnTime Now() + TimeValue("00:10:00"), "OntimeRun"
End If
VBA.DoEvents
End Sub |
|