Sub 共用參照()
Set MyBook = ThisWorkbook
Set Sht1 = MyBook.Sheets("台指期")
If [A1] = "日盤" And Time >= TimeValue("08:44:00") And Time <= TimeValue("13:45:00")Then '依據儲存格A1的值為"日盤"或"夜盤"--> 選擇"日盤"
StartTime = "08:44:10" '日盤開盤前50秒-->執行程式
EndTime = "13:45:10" '日盤收盤後10秒-->停止程式
End If
If [A1] = "夜盤" And Time >= TimeValue("15:00:00") And Time <= TimeValue("05:00:00") Then '選擇夜盤(15:00:00 ~ 隔日早上 05:00:00)
Sub 清除記錄資料()
Dim xE As Range
If MsgBox("※確定要清除〔Sheet1〕的記錄嗎? ", 4 + 32 + 256) = vbNo Then Exit Sub
Call 共用參照
Set xE = Sht1.[a65536].End(xlUp)
If xE.Row <= 9 Then Exit Sub
Range(Sht1.[A9], xE(0)).EntireRow.Delete
If ActiveSheet.Name = Sht1.Name Then ActiveWindow.ScrollRow = 1
End Sub作者: ABK 時間: 2018-6-6 23:31