View Single Post
 
Old 12-18-2018, 06:28 PM
headlockpdp headlockpdp is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2018
Posts: 2
headlockpdp is on a distinguished road
Default Highlighting the entire row

Hello,

How do I set conditional formatting to highlight the entire row in a table?

My document has 4 columns. In one of the columns I have a drop down content control box that I would like to use in order to change the color fill for the entire row.


The code below only highlights that particular cell rather than the whole row:


Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl
  If Len(.Title) < 6 Then Exit Sub
  If Left(.Title, 6) = "Status" Then
    Select Case .Range.Text
      Case "COMPLETE": .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdGreen
      Case "Pending": .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdYellow
      Case Else: .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdNoHighlight
    End Select
  End If
End With
End Sub

Last edited by macropod; 12-18-2018 at 06:29 PM. Reason: Added code tags