- 帖子
- 1018
- 主題
- 15
- 精華
- 0
- 積分
- 1058
- 點名
- 0
- 作業系統
- win7 32bit
- 軟體版本
- Office 2016 64-bit
- 閱讀權限
- 50
- 性別
- 男
- 來自
- 桃園
- 註冊時間
- 2012-5-9
- 最後登錄
- 2022-9-28
|
本帖最後由 stillfish00 於 2013-6-21 11:20 編輯
回復 1# vzcen
沒用過DDE,僅供參考。- Private gbStart As Boolean
- Private recTime
- Private recValue
- Private Sub Worksheet_Calculate()
- Dim ddeValue
-
- If gbStart Then
- ddeValue = [B6].Value
- If IsEmpty(recValue) Then recTime = Time: recValue = ddeValue
-
- If Minute(recTime) = Minute(Time) Then
- If ddeValue > recValue Then recTime = Time: recValue = ddeValue
- Else
- '紀錄時間在D欄最後一列下方
- Cells(Rows.Count, "D").End(xlUp).Offset(1).Value = recTime
- '紀錄價格在E欄最後一列下方
- Cells(Rows.Count, "E").End(xlUp).Offset(1).Value = recValue
- recTime = Time: recValue = ddeValue
- End If
- End If
-
- End Sub
- '可建立按鈕開始或結束
- Private Sub StartRecordData()
- gbStart = True
- End Sub
- Private Sub StopRecordData()
- gbStart = False
- recTime = Empty
- recValue = Empty
- End Sub
複製代碼 |
|