Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I have a several columns of check boxes in a table and would like to total
the number of €śTrue€ť boxes for each column. Can this be done? -- Don |
#2
![]() |
|||
|
|||
![]()
Don,
Yes it can by using macros. I am a novice with VBA and rusty to boot, but here is an example of code to tally the results of check boxes in columns 2, 3, 4, and 5 (I used labels b, c, d, e) of a table that might get you started. You will need to insert text fields in the last row of the columns bookmarked as indicated in the code to hold the results. If you have further problems you might want to post in the VBA beginner or general group where the heavies hang out. Sub TallyResults() Dim bTotal As Integer, cTotal As Integer, dTotal As Integer, eTotal As Integer bTotal = 0 cTotal = 0 dTotal = 0 eTotal = 0 For i = 1 To ActiveDocument.Tables(1).Rows.Count On Error Resume Next bTotal = bTotal - ActiveDocument.Tables(1).Cell(i, 2).Range.FormFields(1).CheckBox.Value cTotal = cTotal - ActiveDocument.Tables(1).Cell(i, 3).Range.FormFields(1).CheckBox.Value dTotal = dTotal - ActiveDocument.Tables(1).Cell(i, 4).Range.FormFields(1).CheckBox.Value eTotal = eTotal - ActiveDocument.Tables(1).Cell(i, 5).Range.FormFields(1).CheckBox.Value Next i ActiveDocument.FormFields("bTotal").Result = bTotal ActiveDocument.FormFields("cTotal").Result = cTotal ActiveDocument.FormFields("dTotal").Result = dTotal ActiveDocument.FormFields("eTotal").Result = eTotal End Sub -- Greg Maxey/Word MVP A Peer in Peer to Peer Support Don wrote: I have a several columns of check boxes in a table and would like to total the number of "True" boxes for each column. Can this be done? |
#3
![]() |
|||
|
|||
![]()
Thanks. I have not had time to try this yet, but it looks like it makes sense.
"Don" wrote: I have a several columns of check boxes in a table and would like to total the number of €śTrue€ť boxes for each column. Can this be done? -- Don |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Form Check Boxes not working | Microsoft Word Help | |||
how do i make check mark boxes in mircosoft word//?? | Microsoft Word Help | |||
Check boxes | Microsoft Word Help | |||
how do i insert boxes in text (to check off later when printed)? | Microsoft Word Help | |||
Check boxes in a Word form | Microsoft Word Help |