Formulas in Word Tables

  • Thread starter Thread starter Dave
  • Start date Start date
Terry,
After 3 tries I got the ToolsCalculate into the Tools
menu. Nothin. (P.S. How do I remove it from the toolbar
where it now resides twice?)

What I'm trying to do is create a blank purchase
requisition form where in one cell you can put the
quantity; in the next cell to the right the price per
each; and have the next cell to the right give the total.
 
Right click the menu and click customize. Drag the Calculate icon off the
menu and drop it in the document.

For your form requirement see:
You should get a good start here and the linked articles by Dian Chapman:

http://word.mvps.org/faqs/customization/FillinTheBlanks.htm

That link will show you how to set up forms.

Your basic calculation is:

A1 B1 C1
5 $2.00 {=(a1*b1)}

The field code braces { } are entered with CTRL+F9. Toggle the field code
to display the result with ALT+F9. When a change is made, you can update
the field by selecting the field and pressing F9, or update all fields by
pressing CTRL+a (selects all) and pressing F9, toggling to and from print
preview (if "Update Fields" is checked in the File>Print>Options dialog
box), or running a macro something like:

Sub UpdateFields()
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub
 
Excellent. Thanks very much.
-----Original Message-----
Right click the menu and click customize. Drag the Calculate icon off the
menu and drop it in the document.

For your form requirement see:
You should get a good start here and the linked articles by Dian Chapman:

http://word.mvps.org/faqs/customization/FillinTheBlanks.h tm

That link will show you how to set up forms.

Your basic calculation is:

A1 B1 C1
5 $2.00 {=(a1*b1)}

The field code braces { } are entered with CTRL+F9. Toggle the field code
to display the result with ALT+F9. When a change is made, you can update
the field by selecting the field and pressing F9, or update all fields by
pressing CTRL+a (selects all) and pressing F9, toggling to and from print
preview (if "Update Fields" is checked in the File>Print>Options dialog
box), or running a macro something like:

Sub UpdateFields()
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.




.
 
Back
Top