參考資料來源
Option Explicit
Dim alertTime
Dim timerActivate
Public Sub EventMacro()
If Range("B17").Value >= 30 Then
'1.Set next time job
alertTime = Now + TimeValue("00:00:10")
Application.OnTime alertTime, "EventMacro"
'2.Your time job
Application.StatusBar = SendOrderText("type1", "data1")
Else
timerActivate = False
End If
End Sub
Public Sub StartTimer()
alertTime = Now + TimeValue("00:00:10")
Application.OnTime alertTime, "EventMacro"
timerActivate = True
End Sub
Public Function SendOrderText(strOrderType, strOrderData)
SendOrderText = Now
End Function
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$17" Then
If Range("B17").Value >= 30 Then
If timerActivate = False Then
Call StartTimer
End If
End If
End If
End Sub