问题描述
我已经开发了Excel实时数据馈送(RTD)来监视股票价格的到来.
我想找到一种随价格变化而改变单元格颜色的方法.
例如,当值更改时,最初的绿色单元格将变为红色(通过包含的RTD公式在其上出现新价格),然后在到达新价格时又变回绿色,依此类推...
I have developed an Excel Real-Time Data Feed (RTD) to monitor Stock Prices as they arrive.
I Would like to find a way to change the color of a cell as prices change.
For example, a cell initially Green would turn to Red when the value changes (new price occurred on it via RTD Formula it contains) and then change back to Green when a new price arrives, and so on...
推荐答案
也许这可以帮助您入门?我认为刷新实时数据时会引发一个事件.将实时数据存储在变量中并检查其是否已更改的概念文件
Maybe this can get you started?I supose a event is raised when the real time data is refreshed.the concept sis to store the real time data in a variabele and check if it has changed
Dim rtd As String
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ActiveSheet.Range("A1")
If .Value <> rtd Then
Select Case .Interior.ColorIndex
Case 2
.Interior.ColorIndex = 3
Case 3
.Interior.ColorIndex = 4
Case 4
.Interior.ColorIndex = 3
Case Else
.Interior.ColorIndex = 2
End Select
Else
.Interior.ColorIndex = 2
End If
rtd = .Value
End With
End Sub
这篇关于Excel:当单元格值更改时,也可以更改单元格颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!