If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
Add & Multiply Check boxes in a column.
I'm new in working with tables in a word document and
been beating my brains on calculating the check boxes in a column. Seems simple but I have gotten a team of people together to figure it out, but can't. I am spending way too much time figuring this simple task out and now seeking further help. In the form the user will check the boxes that applies to the question. I would like the form to add up the check boxes in that column and multiply by the respected column number (like in a comment form 1 - 5)for a total score at the bottom of each column. Seems very simple but I can't make it to work. Please help if you have done this before. Thank you very much! Aloha, Janice |
#2
|
|||
|
|||
Add & Multiply Check boxes in a column.
Assuming that the checkboxes are in rows 1 through n - 1 and columns 2
through 6, where n is the number of rows in the table and that in the cells in columns 2 through 6 of the last row of the table, you have text type formfields in which the result will be displayed, if you run the following macro on exit from each of the checkbox formfields, it will do what you want: Dim i As Long, sumofchecks As Longsumofchecks = 0 For i = 1 To Selection.Tables(1).Rows.Count - 1 sumofchecks = sumofchecks - Selection.Columns(1).Cells(i).Range.FormFields(1). CheckBox.Value Next i Selection.Columns(1).Cells(Selection.Tables(1).Row s.Count).Range.FormFields( 1).Result = sumofchecks * (Selection.Information(wdEndOfRangeColumnNumber) - 1) If there are no checkboxes in the first row, change the second line to For i = 2 etc.. You may also want to take a look at the article "Making groups of Check Box Form Fields mutually exclusive (so that they behave like radio buttons) " at: http://word.mvps.org/FAQs/TblsFldsFm...FmFldChbxs.htm -- Please post any further questions or followup to the newsgroups for the benefit of others who may be interested. Unsolicited questions forwarded directly to me will only be answered on a paid consulting basis. Hope this helps Doug Robbins - Word MVP "Janice" wrote in message ... I'm new in working with tables in a word document and been beating my brains on calculating the check boxes in a column. Seems simple but I have gotten a team of people together to figure it out, but can't. I am spending way too much time figuring this simple task out and now seeking further help. In the form the user will check the boxes that applies to the question. I would like the form to add up the check boxes in that column and multiply by the respected column number (like in a comment form 1 - 5)for a total score at the bottom of each column. Seems very simple but I can't make it to work. Please help if you have done this before. Thank you very much! Aloha, Janice |
Thread Tools | |
Display Modes | |
|
|