View Single Post
 
Old 02-21-2015, 07:27 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

If your structure is consistent (6 checks for each question) then the following should work. You will have to use a naming convention like "grp1Chk1, grp1Chk2, etc. and name the group totals grp1Tally, grp2Tally etc.

Code:
Sub TallyTicks()
'A basic Word macro coded by Greg Maxey
Dim lngGroup As Long
Dim lngIndex As Long
Dim lngTally As Long
  lngGroup = Mid(Selection.FormFields(1).Name, 4, 1)
  For lngIndex = 1 To 3
    If ActiveDocument.FormFields("grp" & lngGroup & "Chk" & lngIndex).CheckBox.Value = True Then
      lngTally = lngTally + 1
    End If
  Next lngIndex
  ActiveDocument.FormFields("grp" & lngGroup & "Tally").Result = CStr(lngTally)
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote