EliseFreedman
Programmer
Hi There
I have a series of monthly planning spreadsheets which feed into an annual spreadsheet. The idea of the sheet is that mgt update each KPI on a scale of 1 - 6 (Column G) where 1 is not started and 6 is overdue. When the scale is selected, I want to then colour another column (Column K) based on which of the scale is selected for example if 1 is selected then that cell in column K should be white. Similarly if 6 is selected then the cell should be Red.
I am using the following code to achieve the above fairly successfully. My problem is that I have to actually manually select the cells in Column K before the cells will change colour. I would like to be able to change my code so that as soon as I select the value in column G, the colour will change in column K. How do I do this?
I have a series of monthly planning spreadsheets which feed into an annual spreadsheet. The idea of the sheet is that mgt update each KPI on a scale of 1 - 6 (Column G) where 1 is not started and 6 is overdue. When the scale is selected, I want to then colour another column (Column K) based on which of the scale is selected for example if 1 is selected then that cell in column K should be white. Similarly if 6 is selected then the cell should be Red.
I am using the following code to achieve the above fairly successfully. My problem is that I have to actually manually select the cells in Column K before the cells will change colour. I would like to be able to change my code so that as soon as I select the value in column G, the colour will change in column K. How do I do this?
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim WS_Range As String
WS_Range = "K15:K34" '<=== change to suit
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_Range)) Is Nothing Then
With Target
Select Case .Value
Case "Overdue": .Interior.ColorIndex = 3
Case "Overdue But Recoverable": .Interior.ColorIndex = 45
Case "Not Started": .Interior.ColorIndex = 2
Case "On Plan": .Interior.ColorIndex = 10
Case "Complete": .Interior.ColorIndex = 25
Case "Planned": .Interior.ColorIndex = 15
End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub