T
TomorrowsMan
- I have a table in Word 2000, 6 rows, 2 columns.
- In the first column, rows 1-5 are for review criteria, and in the
second column is a dropdown box in each cell with rating values from
0-4.
- The user selects a rating from the dropdown box, then in the last
cell of the table (row 5, col 2), a formula calculate the average.
The problem is, not all of the fields are mandatory, so the number of
criteria can range from 1 to 5. Also, it is possible to get a "0.0"
rating.
I had been using this; obviously, my question involves how to make the
value of i dynamic based on the number of criteria used:
Sub QTotal()
Dim aa As Single, i As Single
aa = 0
For i = 1 To 5
aa = aa + Val(ActiveDocument.FormFields("Qt0" & i).Result)
Next i
aa = aa / 5
ActiveDocument.FormFields("QTotal").Result = _
Format(aa, "#.##")
End Sub
Thank you,
Chris
- In the first column, rows 1-5 are for review criteria, and in the
second column is a dropdown box in each cell with rating values from
0-4.
- The user selects a rating from the dropdown box, then in the last
cell of the table (row 5, col 2), a formula calculate the average.
The problem is, not all of the fields are mandatory, so the number of
criteria can range from 1 to 5. Also, it is possible to get a "0.0"
rating.
I had been using this; obviously, my question involves how to make the
value of i dynamic based on the number of criteria used:
Sub QTotal()
Dim aa As Single, i As Single
aa = 0
For i = 1 To 5
aa = aa + Val(ActiveDocument.FormFields("Qt0" & i).Result)
Next i
aa = aa / 5
ActiveDocument.FormFields("QTotal").Result = _
Format(aa, "#.##")
End Sub
Thank you,
Chris