Just for fun, I agree with Greg's modifications, though changing the code to
Option Explicit
Sub Document_ContentControlOnExit(ByVal oCC As ContentControl, Cancel As Boolean)
If oCC.Type = 3 Or oCC.Type = 4 Then
Select Case oCC.Range.Text
Case "Y"
oCC.Range.Cells(1).Shading.BackgroundPatternColor = &H50B000
oCC.Range.Font.ColorIndex = wdWhite
Case "N"
oCC.Range.Cells(1).Shading.BackgroundPatternColor = wdColorRed
oCC.Range.Font.ColorIndex = wdWhite
Case "NA"
oCC.Range.Cells(1).Shading.BackgroundPatternColor = &HC07000
oCC.Range.Font.ColorIndex = wdWhite
Case Else
oCC.Range.Cells(1).Shading.BackgroundPatternColor = wdColorAutomatic
oCC.Range.Font.Color = &H808080
End Select
UpdateTotals
End If
lbl_Exit:
Exit Sub
End Sub
will make the selections more readable and match the colours I used in the attachment I returned earlier.
The code that updates the totals in that attachment can also be tweaked further
Option Explicit
Sub UpdateTotals()
'A basic Word macro coded by Greg Maxey, http://gregmaxey.com/word_tips.html, 12/2/2018
'Graham Mayor - https://www.gmayor.com - Last updated - 04 Dec 2018
Dim lngY As Long, lngN As Long, lngNA As Long, lngNullorInvalid As Long
Dim oCC As ContentControl
For Each oCC In ActiveDocument.Range.ContentControls
If oCC.Type = 3 Or oCC.Type = 4 Then
Select Case oCC.Range.Text
Case Is = "Y": lngY = lngY + 1
Case Is = "N": lngN = lngN + 1
Case Is = "NA": lngNA = lngNA + 1
Case Else: lngNullorInvalid = lngNullorInvalid + 1
End Select
End If
DoEvents
Next oCC
ActiveDocument.SelectContentControlsByTitle("Not Selected").Item(1).Range.Text = lngNullorInvalid
ActiveDocument.SelectContentControlsByTitle("Yes").Item(1).Range.Text = lngY
ActiveDocument.SelectContentControlsByTitle("No").Item(1).Range.Text = lngN
ActiveDocument.SelectContentControlsByTitle("NA").Item(1).Range.Text = lngNA
lbl_Exit:
Set oCC = Nothing
Exit Sub
End Sub