This example creates a 3x3 table at the beginning of the active document and then averages the numbers in the first column.
Set myRange = ActiveDocument.Range(0, 0)
Set myTable = ActiveDocument.Tables.Add(myRange, 3, 3)
With myTable
.Cell(1,1).Range.InsertAfter "100"
.Cell(2,1).Range.InsertAfter "50"
.Cell(3,1).Formula Formula:="=Average(Above)"
End With
This example inserts a formula at the insertion point that determines the largest number in the cells above the selected cell.
Selection.Collapse Direction:=wdCollapseStart
If Selection.Information(wdWithInTable) = True Then
Selection.Cells(1).Formula Formula:="=Max(Above)"
Else
MsgBox "The insertion point is not in a table."
End If