Worksheets("DDE").Range("j1")=""
If Worksheets("DDE").Range("j1")<> Worksheets("DDE").Range("i1") and
Worksheets("DDE").Range("j1")>0 Then '以 j1 成交量判斷是否有交易
Worksheets("DDE").Range("j1")= Worksheets("DDE").Range("i1")
end if
' Worksheets("DDE").Range("i1") 跟 DDE 資訊源連結作者: ken2192 時間: 2015-10-16 16:29
Option Explicit
'自選股 工作表模組
Private Sub AWorksheet_Calculate()
Dim Rng As Range, E As Range
On Error Resume Next
If IsError([A9]) Then Exit Sub '檔案開啟時DEE會傳回 @N/A
If Time < #9:00:00 AM# Then
Set Rng = UsedRange.SpecialCells(xlCellTypeFormulas, xlErrors)
If Not Rng Is Nothing Then Debug.Print Time, Not Rng Is Nothing
With Range("A9", Range("A9").End(xlDown))
.Columns("K") = "" ''清空H欄的第一筆量
End With
Exit Sub
End If
Set Rng = Range("A9", Range("A9").End(xlDown)).Columns("K") 'K欄(第一筆量)的位置
If Time >= #9:00:00 AM# And Rng.Count <> Application.Count(Rng) Then
' K欄的個數<>K欄有數字的個數,還有股票第一筆量沒有輸入
Application.EnableEvents = False
For Each E In Rng.Cells
If E = "" And E.Cells(1, 2) > 0 Then
E = E.Cells(1, 2)
End If
Next
Application.EnableEvents = True
End If
End Sub作者: GBKEE 時間: 2015-10-17 13:57