This code should work for you
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim intColour As Integer
Set rng = ActiveSheet.Range(Cells(2, 8), Cells(Rows.Count, 13).End(xlUp))
If Not Intersect(Target, rng) Is Nothing Then
Select Case Range("P2").Value
Case 1: intColour = 6
Case 2: intColour = 3
Case 3: intColour = 7
Case 4: intColour = 18
Case 5: intColour = 15
Case 6: intColour = 42
Case Else: 'do nothing
End Select
Target.Interior.ColorIndex = intColour
End If
End Sub
Bookmarks