How to automatically get the sum of a column in a Word table ?

H

Helge V. Larsen

I have a table in a Word document. In the bottom row I want to have the sum
of the cells above. AND THIS SUM SHOULD BE UPDATED AUTOMATICALLY WHEN ANY OF
THE ABOVE CELLS ARE CHANGED.

I know that a good starting point is to enter the formula { =SUM(ABOVE) } in
the cells in the bottom row, and then write a routine :
Sub Update_Fields
ActiveDocument.Fields.Update
End Sub

But how to get this activated whenever a value is changed ???
I have not been able to find anything like Excel VBA's event routines. A
Document_Change or Table_Change event would be nice.
 
D

Doug Robbins - Word MVP

Hi Helge,

The way to do it automatically is to use formfields with the calculate on
exit property set for each of those formfields that contribute to the
result.

--
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
"Helge V. Larsen" wrote in message news:[email protected]...
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Helge V. Larsen > écrivait :
In this message, < Helge V. Larsen > wrote:

|| I have a table in a Word document. In the bottom row I want to have the
sum
|| of the cells above. AND THIS SUM SHOULD BE UPDATED AUTOMATICALLY WHEN ANY
OF
|| THE ABOVE CELLS ARE CHANGED.
||
|| I know that a good starting point is to enter the formula { =SUM(ABOVE) }
in
|| the cells in the bottom row, and then write a routine :
|| Sub Update_Fields
|| ActiveDocument.Fields.Update
|| End Sub
||
|| But how to get this activated whenever a value is changed ???
|| I have not been able to find anything like Excel VBA's event routines. A
|| Document_Change or Table_Change event would be nice.

Answered in vba.general,

Please do not multipost.

If you want you can crosspost (Many newsgroups in the To: field when you
create your message.)

The reason is simple:
People may end up "wasting" their time answering a post that has already
been answered elsewhere, thus it may be very likely that their particular
response to a post be totally ignored if the reply received elsewhere was
satisfactory to the original poster.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top