Table.Cell method (Word)
Returns a Cell object that represents a cell in a table.
Syntax
expression. Cell
( _Row_
, _Column_
)
expression Required. A variable that represents a 'Table' object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Row | Required | Long | The number of the row in the table to return. Can be an integer between 1 and the number of rows in the table. |
Column | Required | Long | The number of the cell in the table to return. Can be an integer between 1 and the number of columns in the table. |
Return value
Cell
Example
This example creates a 3x3 table in a new document and inserts text into the first and last cells in the table.
Dim docNew As Document
Dim tableNew As Table
Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3)
With tableNew
.Cell(1,1).Range.InsertAfter "First cell"
.Cell(tableNew.Rows.Count, _
tableNew.Columns.Count).Range.InsertAfter "Last Cell"
End With
This example deletes the first cell from the first table in the active document.
If ActiveDocument.Tables.Count >= 1 Then
ActiveDocument.Tables(1).Cell(1, 1).Delete
End If
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.