VBA combination drop down macro - changing colors
Hello,
My first post on here and looking for some help!
I have two different drop downs in a table in word. I have it set up so when certain items are selected, the cells turn to a certain color. I want to have it so when certain combinations are selected, both cells turn to a specific color.
For example; when Manageable and Unlikely are selected, I want both cells to be Lime colored. When Major and Likely are selected, I want both cells to be Red.
Below is my code. I am completely stuck. This is currently working with only changing one cell at a time.
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
If ContentControl.Title = "Impact" Then
With ContentControl.Range
Select Case .Text
Case "Manageable"
.Cells(1).Shading.BackgroundPatternColor = wdColorLime
Case "Moderate"
.Cells(1).Shading.BackgroundPatternColor = wdColorYellow
Case "Major"
.Cells(1).Shading.BackgroundPatternColor = wdColorRed
Case "Catastrophic"
.Cells(1).Shading.BackgroundPatternColor = wdColorRed
End Select
End With
End If
If ContentControl.Title = "Likelihood" Then
With ContentControl.Range
Select Case .Text
Case "Unlikely"
.Cells(1).Shading.BackgroundPatternColor = wdColorLime
Case "Possible"
.Cells(1).Shading.BackgroundPatternColor = wdColorYellow
Case "Likely"
.Cells(1).Shading.BackgroundPatternColor = wdColorYellow
Case "Almost Certain"
.Cells(1).Shading.BackgroundPatternColor = wdColorRed
End Select
End With
End If
End Sub
|