Firstly, thanks for taking time out to read this.
Secondly, I hope you can help!
I'm trying to colour columns 'A' thru 'O', based upon data entered in cell K.
Currently, I've got the following code made up to do this, but it colours all cells from A through IV on that row. Is it possible to amend it so that the range is restricted to only cells 'A' through 'O' on that row?
Secondly, I hope you can help!
I'm trying to colour columns 'A' thru 'O', based upon data entered in cell K.
Currently, I've got the following code made up to do this, but it colours all cells from A through IV on that row. Is it possible to amend it so that the range is restricted to only cells 'A' through 'O' on that row?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [K3:K9999]) Is Nothing Then
If Target.Value = "section 1" Then
Target.EntireRow.Interior.ColorIndex = 15
ElseIf Target.Value = "section 2" Then
Target.EntireRow.Interior.ColorIndex = 42
ElseIf Target.Value = "Structures Bay" Then
Target.EntireRow.Interior.ColorIndex = 7
ElseIf Target.Value = "section 3a" Or Target.Value = "section 3b" Then
Target.EntireRow.Interior.ColorIndex = 6
ElseIf Target.Value = "section 4" Then
Target.EntireRow.Interior.ColorIndex = 10
Else: Target.EntireRow.Interior.ColorIndex = xlNone
End If
End If
End Sub