返回列表 上一主題 發帖

[發問] 請教此程序如何改?

回復 1# t8899
試試看
  1. Option Explicit
  2. Public Runtime
  3. Sub a123()
  4.     Static Msg As Boolean
  5.     Dim mytime As String
  6.     If [U1] <> 1 Then
  7.         On Error Resume Next
  8.         Application.OnTime EarliestTime:=TimeValue(Runtime), _
  9.             Procedure:="a123", Schedule:=False
  10.         Exit Sub
  11.         On Error GoTo 0
  12.     End If
  13.    zzzzz
  14.     If Range("V14") = 1 Then mytime = "00:01:00"
  15.     If Range("V14") = 2 Then mytime = "00:02:00"
  16.     If Range("V14") = 3 Then mytime = "00:00:30"
  17.     If Range("V14") = 4 Then mytime = "00:00:15"
  18.     '--------------------------------------
  19.     With Range("I15")
  20.         If Msg = False Then
  21.             Msg = True
  22.             Runtime = Time + TimeValue(mytime)
  23.             .Value = Runtime
  24.             .NumberFormatLocal = "h:mm:ss;@"
  25.         Else
  26.             Runtime = .Value + TimeValue(mytime)
  27.             .Value = Runtime
  28.         End If
  29.     End With
  30.     '------------------------------------------------------
  31.     Application.OnTime Runtime, "Sheet6.a123"
  32. End Sub
複製代碼
感恩的心......(在麻辣家族討論區.用心學習會有進步的)
但資源無限,後援有限,  一天1元的贊助,人人有能力.

TOP

        靜思自在 : 君子立恆志,小人恆立志。
返回列表 上一主題