Hi, I need to go through a column of a table and sum all its values.
Something like in text controls refered as total=total+.textbox.value...how
to extract the value of a cell.
thanks
Juan Uribe
Hi Juan,
If you know the table and column you can set an object reference to
simplify things.
eg
Dim myTableColumn As Column
Dim ThisTableNum As Single
Dim ThisTableColumn As Single
ThisTableNum = 2 'lets work with table 2
ThisTableColumn = 2 'lets work with column 2
Set myTableColumn =
ActiveDocument.Tables(ThisTableNum).Columns(ThisTableColumn)
Dim x
Dim thisCell As Cell
Dim Tot
Dim strCellText As String
For x = 1 To myTableColumn.Cells.Count
Set thisCell = myTableColumn.Cells(x)
strCellText = thisCell.Range.Text
'strip the cell marker which at the end of each cell
strCellText = Left(strCellText, Len(strCellText) - 2)
Tot = Tot + Val(strCellText)
Next
Hope this helps.
Cheers
TonyS.