Here is the code I am using to select a value and change the color of the target, however the target I want to change the color of is the cell immediately to the right of the select case value.
For example, if the cell value in A1 is equal to cake, then B1 needs the cell color to change.
I'm thinking that the line of color setting the icolor needs to be offset, but I'm not sure how and if there would be any other snippets of code I would need to place into my existing code.
Any help would be great.
For example, if the cell value in A1 is equal to cake, then B1 needs the cell color to change.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Select Case Target
Case "cake"
icolor = 9
Case "pie"
icolor = 11
Case Else
icolor = 22
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
Any help would be great.