If Time < TimeValue("8:45:00") Or Time > TimeValue("13:46:00") Then Exit Sub
'If Sheet1.Range("大台成交量") = LastVol1 Then Exit Sub
pos1 = Application.Match(Sheet1.Range("大台時間"), Sheet1.Range("時間一"), 1) + 301
If pos1 > 601 Then pos1 = 601
成交價 = Sheet1.Range("大台成交價")
成交量 = Sheet1.Range("大台成交量")
If Not (Application.WorksheetFunction.IsNA(pos1) Or Application.WorksheetFunction.IsErr(pos1)) Then
If Sheet1.Cells(pos1, 2) = "" Then
Sheet1.Cells(pos1, 2) = 成交價
Sheet1.Cells(pos1, 3) = 成交價
Sheet1.Cells(pos1, 4) = 成交價
Sheet1.Cells(pos1, 5) = 成交價
Sheet1.Cells(pos1, 6) = 成交量 - LastVol1
LastVol1 = 成交量
Else
If 成交價 > Sheet1.Cells(pos1, 3) Then
Sheet1.Cells(pos1, 3) = 成交價
End If
If 成交價 < Sheet1.Cells(pos1, 4) Then
Sheet1.Cells(pos1, 4) = 成交價
End If
Sheet1.Cells(pos1, 5) = 成交價
Sheet1.Cells(pos1, 6) = Sheet1.Cells(pos1, 6) + 成交量 - LastVol1
LastVol1 = 成交量
End If
End If
這是收集K線的片段VBA
當中用到MATCH 可是裡面沒有設定多久RUN一次
那是一直循環嗎?
X座標(時間一)已經先打好了 09:00,09:01,09:02......
再用MATCH比對現在時間(大台時間) 那怎麼知道多久比對一次還是不斷在比對? |