I need help with a macro to notify me (changing the background color of the cell to red) when the value (always the number format) changes in any cells in the row. I want the background of cell E3 to change to red if any of the values in cells F3: AN3 change from their current values.
The numbers in cells F3: AN3 will be entered manually or through copy and paste of the line, and there will be no formulas. Similarly, if any values in cells F4: AN4 are changed, I would like cell E4 to change to a red background and so on for each of the lines in the diagram. Not all lines will always matter, so I would look for changes from "to any # or from one # to another # or from any # to" ". Ideally, this would be an event macro that does not need to be triggered manually.
Below is the code I started working with:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F3:AN3")) Is Nothing Then KeyCellsChanged
End Sub
Private Sub KeyCellsChanged()
Dim Cell As Object
For Each Cell In Range("E3")
Cell.Interior.ColorIndex = 3
Next Cell
End Sub
However, this macro seems to work regardless of whether the number in the cell changes, while I press the enter button, it highlights E3 as red.
Any help is much appreciated!
source
share