Hello Geraldine C! My name is Jeremy and I’m happy to help you with your question.
I generated this macro below to help give you an idea on how to set up the VBA to color a cell based on a yes or no question, which in your case would be, is it of this certain value, yes, then shade.
Sub ShadeCellsBasedOnValue()
Dim tbl As Table
Dim cell As Cell
' Specify the table you want to work with
Set tbl = ActiveDocument.Tables(1) ' Change the index to match your table's index
' Loop through each cell in the table
For Each cell In tbl. Range.Cells
If cell. Range.Text = "Yes" Then
cell. Shading.BackgroundPatternColor = wdColorYellow
ElseIf cell. Range.Text = "No" Then
cell. Shading.BackgroundPatternColor = wdColorRed
End If
Next cell
End Sub
As a precautionary note, it is always smart to back up your data before making changes.
Regards,