Cell.Delete method (Word)
Deletes a table cell or cells and optionally controls how the remaining cells are shifted.
expression.Delete( _ShiftCells_
)
expression Required. A variable that represents a 'Cell' object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
ShiftCells | Optional | Variant | The direction in which the remaining cells are to be shifted. Can be any WdDeleteCells constant. If omitted, cells to the right of the last deleted cell are shifted left. |
This example deletes the first cell in the first table of the active document.
Sub DeleteCells()
Dim intResponse As Integer
intResponse = MsgBox("Are you sure you want " & _
"to delete the cells?", vbYesNo)
If intResponse = vbYes Then
ActiveDocument.Tables(1).Cell(1, 1).Delete
End If
End Sub
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.