I have 10 dropdown fields that have numbers 1 to 10 listed for a user to choose a rating. I want to “average” the 10 fields after user selects a rating for each of the 10 fields. I found the code below that converts the field value to a number and “sums” the fields. Does anyone know what code I need to add to have the macro “Average” the value of the fields, rather than just sum them? Many thanks!
Sub MainDropdownCalc()
‘Assigns DROPDOWN1 text to the variable A$
A$ = WordBasic.[GetFormResult$](“DROPDOWN1”)
‘Assigns DROPDOWN2 text to the variable B$
B$ = WordBasic.[GetFormResult$](“DROPDOWN2”)
‘Assigns DROPDOWN2 text to the variable B$
C$ = WordBasic.[GetFormResult$](“DROPDOWN3”)
‘Converts string into a number
A = Val(A$) + Val(B$) + Val(C$)
‘ Set the result to the “Text4” FormField and
‘ converts the value back into a string
WordBasic.[SetFormResult] “TEXT4”, Str$(A)
End Sub