Hello,
Just looking to expand on something I have in the works.
Background:
Trying to have it where a certain cell will change colors depending if a date is changed in a certain cell.
Example: if either dates in cells E16 or F16 change, I would like for the date changed to highlight in color Along with cell J17 to change a certain color(any color at this point).
Reason is so I can show that when you changed this date(highlighted) that it affects this cell(J17).
I would like to expand this for multiple cells, which is where im having trouble. Current Macro below. The End If is erroring out and I think that has something to do with the additional cells that I want to check (E4, F4, color J5).
Also the color would be different for each look, so E16, F16, J17=Yellow. E4, F4, J5=red
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
Dim cell As Range
' See if a cell was updated in E16 or F16
Set myRange = Intersect(Target, Range("E16:F16"))
If myRange Is Nothing Then Exit Sub
' Highlight changed cell(s)
For Each cell In myRange
cell.Interior.Color = 65535
Next cell
' Highlight cell J17
Range("J17").Interior.Color = 65535
End If
' See if a cell was updated in E4 or F4
Set myRange = Intersect(Target, Range("E4:F4"))
If myRange Is Nothing Then Exit Sub
' Highlight changed cell(s)
For Each cell In myRange
cell.Interior.Color = 65535
Next cell
' Highlight cell J5
Range("J5").Interior.Color = 65535
End Sub
Just looking to expand on something I have in the works.
Background:
Trying to have it where a certain cell will change colors depending if a date is changed in a certain cell.
Example: if either dates in cells E16 or F16 change, I would like for the date changed to highlight in color Along with cell J17 to change a certain color(any color at this point).
Reason is so I can show that when you changed this date(highlighted) that it affects this cell(J17).
I would like to expand this for multiple cells, which is where im having trouble. Current Macro below. The End If is erroring out and I think that has something to do with the additional cells that I want to check (E4, F4, color J5).
Also the color would be different for each look, so E16, F16, J17=Yellow. E4, F4, J5=red
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
Dim cell As Range
' See if a cell was updated in E16 or F16
Set myRange = Intersect(Target, Range("E16:F16"))
If myRange Is Nothing Then Exit Sub
' Highlight changed cell(s)
For Each cell In myRange
cell.Interior.Color = 65535
Next cell
' Highlight cell J17
Range("J17").Interior.Color = 65535
End If
' See if a cell was updated in E4 or F4
Set myRange = Intersect(Target, Range("E4:F4"))
If myRange Is Nothing Then Exit Sub
' Highlight changed cell(s)
For Each cell In myRange
cell.Interior.Color = 65535
Next cell
' Highlight cell J5
Range("J5").Interior.Color = 65535
End Sub