即便在EXCEL中也无法使用精简的公式,何况是WORD中呢? 必须使用VBA,请将光标移到合计的单元格中,运行以下代码可求合计: Sub Tatol() Dim myRange As Range, myCell As Cell Dim PreTable As Table, N As Integer Dim PreCell As Cell, UpCell As Cell With Selection If .Information(wdWithInTable) Then Set myCell = .Cells(1) Set UpCell = .Tables(1).Cell(myCell.RowIndex - 1, myCell.ColumnIndex) Set myRange = ActiveDocument.Range(0, .Tables(1).Range.End) N = myRange.Tables.Count If N = 1 Then myCell.Range.Text = Val(UpCell.Range.Text) Else Set PreTable = ActiveDocument.Tables(N - 1) Set PreCell = PreTable.Cell(myCell.RowIndex, myCell.ColumnIndex) myCell.Range.Text = VBA.Val(PreCell.Range.Text) + Val(UpCell.Range.Text) End If End If End With End Sub |