Dear Excel forum - excel newbie here.

I want to get conditional formating, and hence need to construct a code in VBA, that for a given column (or clomuns) makes a cell next to it a specific colour (e.g. red) given that the value of the column (or columns) is e.g 5 (or at least 5)

The code i have tried so for looks as following, but doensīt seem to work at all - itīs constructed from copy/pasting other solutions, for similar problems:


Private Sub colourChange(ByVal Target As Integer)


On Error Resume Next

If Target.Column = 7 Then

If Taget.Value = 5 Then

Application.EnableEvents = False

Target.Offset(0, 4).Interior.ColorIndex = 3

End If

End If



exitHandler:

Application.EnableEvents = True

Exit Sub


End Sub


Here i want a cell in colomn K to turn red, if a cell in column G in the same row has the value 5.


I hope you can help me solve my problem,

Thank you in advance