View Single Post
 
Old 04-27-2017, 06:52 AM
runke1tj runke1tj is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Apr 2017
Posts: 2
runke1tj is on a distinguished road
Default 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
Reply With Quote