小弟用了workbook的Open事件來啟動一個用了OnTime功能,來抄錄盤中股價的即時變化,但跑到預設結束時間,出了一個錯誤訊息,請各位前輩幫忙告訴我問題出在哪裡?
編碼如下
Private Sub Workbook_Open()
Application.OnTime TimeValue("21:34:00"), "價差紀錄"
End Sub
--------------------------------------------------------------------------
Sub 價差紀錄()
Dim Line As Double
Dim Close_T As String
Line = Sheet1.Range("F1").End(xlDown).Row
Close_T = Format(Time, "h:m")
If Close_T <> "21:35" Then
Sheet1.Cells(Line + 1, 6) = Cells(2, 6)
Sheet1.Cells(Line + 1, 7) = Cells(2, 7)
Application.OnTime Now + TimeValue("00:00:05"), "價差紀錄"
Else
Application.OnTime Now + TimeValue("00:00:05"), "價差紀錄", , False
End If
End Sub
錯誤訊息如下:
[attach]20798[/attach]作者: stillfish00 時間: 2015-4-27 09:40