Quote from dtrader98:
option to extend original code to column:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Static price(500) As Variant
dim i as integer
'example for column "D" make length est for max number of changes
For i = 1 To 500
If Cells(i, "D") > price(i) Then
Cells(i, "D").Interior.Color = vbGreen
End If
If Cells(i, "D") < price(i) Then
Cells(i, "D").Interior.Color = vbRed
End If
price(i) = Cells(i, "D")
Next i
End Sub
___________________________
I entered osorico code, but cells were not updating to green, only red each time a cell was changed.![]()
What if he has more than 500 rows? What if he has more than 1 column? You used Workbook_change. Where's validation that the changes are being made on the appropriate sheet?
As I said earlier, statics are fine, but performance is affected by how many.
As for my code not working. If you read the comments you'll know why. It's a framework for something robust, not operational other than for testing 1 change at a time.
Osorico
EDIT: I just good-looked your code.
Your code will update all 500 cells every time the event triggers. In this case every time ANY cell on ANY worksheet changes, regardless of which cells you are interested in. MAJOR MAJOR BOTTLENECK! Won't be able to handle normal-speed multiple updates and just forget about multiple fast moving updates.
EDIT 2: I think I got a relatively elegant solution. I'll post WORKING code in a few minutes.
