Hello!
I am trying to code a sheet so if:
A) a user enters a different value in a cell than what is originally in the cell, the cell color changes to
yellow.
But....lets say the user made a mistake, accidentally changed a cell, and needs to change the cell back to it's original value. Here's the other condition I want coded:
B) If the cell reverts back to it's original value, then the cell color should revert back to it's original
color as well.
The sheet I am trying to code this for is in a workbook that multiple users make inputs in. Each user has a column specific for them that they make entries for. The values in the range for user inputs [B:E] are either flagged as Yes (Y) or No (N). Existing Y cells have a gray fill. Exisiting N cells have no fill. See attached image.
I've figured part A) out with the code below. Part B) is where I'm having trouble. Currently my code will change the cell color if a new value is entered, but if the user changes it back to the original value, the cell color remains yellow, because it is a another change in value.
code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B2:E13")) Is Nothing Then
Target.Interior.ColorIndex = 6
End If
End Sub
Appreciate any help on this!
Bookmarks