Example.png
My use case for this thread is to determine the best method to color code cells based on a value in a given cell in each row. As an example:
- If a user were to navigate to row 3, column B and input the text "Accept", the cell background color within row 3 (both column D and column F) would turn green.
- If a user were to navigate to row 3, column D and input the text "Accept", the cell background color within row 3 (for just column F) would turn green. Row 3, column B would be left alone and have a cell background color of white.
- If a user were to navigate to row 3,(column F) and input the text "Accept", row 3 (both column B and column D) would be left alone and the background color would remain white.
- The goal is to ultimately have this logic operate within a for loop for each row so that one row is not dependent on another.
I've started off with the following:
Dim KeyCells2 As Range
' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells2 = Range("H1:H50")
If Not Application.Intersect(KeyCells2, Range(Target.Address)) _
Is Nothing Then
' Display a message when one of the designated cells has been
' changed.
' Place your code here.
For Each cell In KeyCells2
If cell.Value = "push" Then
cell.Interior.ColorIndex = 10
ElseIf cell.Value = " " Then
cell.Interior.ColorIndex = 2
End If
Next cell
' MsgBox "Cell " & Target.Address & " has changed."
End If
End Sub
Any guidance or help would be greatly appreciated. Thanks!
Bookmarks