返回列表 上一主題 發帖

ontime schedule:=false 有問題

ontime schedule:=false 有問題

執行 timestop 沒有問題,但放在 Worksheet_Calculate()
時間到執行為何錯在
Application.OnTime EarliestTime:=tbme, _
        Procedure:="showtime", Schedule:=False




Public abf As Date
Public tbme As Date
Sub showtime()
abf = TimeValue("00:00:01")
tbme = Time + abf
    Application.OnTime tbme, "showtime"
Sheets("Sheet3").Range("t1").Value = Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
End Sub


Sub timestop()
Application.OnTime EarliestTime:=tbme, _
        Procedure:="showtime", Schedule:=False
   End Sub



Private Sub Worksheet_Calculate()
If Format(Now, "hh:mm:ss") = "13:30:34" Then
timestop
End If
end sub

看起來好像是tbme沒資料
增加showtime在第三段的程式
就可以順利執行了
huijuang 發表於 2014-3-14 13:48

showtime 已經手動執行...........這樣會重覆執行???變成跑兩個程序

TOP

回復  t8899

showtima手動執行應該不會把tbme資料帶出來
建議你用逐行執行
然後把區域變數視窗打開
...
huijuang 發表於 2014-3-17 08:05


區域變數視窗如何打開 ???

TOP

        靜思自在 : 做該做的事是智慧,做不該做的事是愚癡。
返回列表 上一主題