0
我正在使用alertTime
和RefreshAll
來更新數據,但不是在我希望刷新的`timevalue'處刷新,而是隨機刷新。alertTime和Timevalue刷新
下面是代碼:
Sub Macro1()
'Macro1 Macro
alertTime = Now + TimeValue("00:01:00") 'hh:mm:ss
Application.OnTime alertTime, "Macro1"
Dim LTime1 As Date, LTime2 As Date
Dim i As Integer, j As Integer
Dim USDJPY As Worksheet, Allrates As Worksheet, EURGBP As Worksheet
Dim LastRow As Long
Set Allrates = Sheets("Allrates")
Set EURUSD = Sheets("EURUSD")
Set EURGBP = Sheets("EURGBP")
LTime1 = TimeValue("15:30:00")
LTime2 = TimeValue("15:32:00")
If Range("P20") = LTime1 Then
Allrates.Range("B18").Copy EURGBP.Cells(EURGBP.Range("B10000").End(xlUp).Row + 1, 2)
End If
If Range("P20") = LTime2 Then
Allrates.Range("B18").Copy EURGBP.Cells(EURGBP.Range("B10000").End(xlUp).Row + 1, 2)
End If
ActiveWorkbook.RefreshAll
End Sub
那就是代碼。當它符合時間條件LTime1和LTime2我想複製粘貼一些值。但我希望每1分鐘進行一次時間步,否則它會一直粘貼。感謝vm Jimmy的幫助 – MGs