View Single Post
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

If you run the following macro when the selection is in the result cell of
the first column (it need not be the first column in the table), it will do
what you want. It assumes that the first row in the table contains headings

Dim i As Long, j As Long, numrange As Range, numtab As Table
Dim numcol As Long, numrow As Long
Dim result As Double
Set numtab = Selection.Tables(1)
numcol = Selection.Information(wdEndOfRangeColumnNumber)
numrow = Selection.Information(wdEndOfRangeRowNumber)
For i = numcol To numcol + 2
result = 0
For j = 2 To numrow - 1
Set numrange = numtab.Cell(j, i).Range
numrange.End = numrange.End - 1
result = result + numrange
Next j
numtab.Cell(numrow, i).Range.InsertBefore result
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
"Srinivas MV" wrote in message
news
Hi,

I am trying to record a macro in a table to count the sum of requirements

1. The table has 3 columns which contain the requirements
2. The macro has to add all the columns and display the total in the last
row
3. The macro has to take care of creation of new row of requirements for
the
total

If anybody has done this earlier, if you can share the idea, it would be
great
--
Thanks
Srinivas