Cell Object (PowerPoint)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Represents a table cell. The Cell object is a member of the CellRange collection. The CellRange collection represents all the cells in the specified column or row. To use the CellRange collection, use the Cells keyword.

You cannot programmatically add cells to or delete cells from a PowerPoint table. Use the Add method of the Columns or Rows collections to add a column or row to a table. Use the Delete method of the Columns or Rows collections to delete a column or row from a table.

Use Cell(row, column), where row is the row number and column is the column number, or Cells(index), where index is the number of the cell in the specified row or column, to return a single Cell object. Cells are numbered from left to right in rows and from top to bottom in columns. With right-to-left language settings, this scheme is reversed. The following example merges the first two cells in row one of the table in shape five on slide two.

With ActivePresentation.Slides(2).Shapes(5).Table

    .Cell(1, 1).Merge MergeTo:=.Cell(1, 2)

End With

This example sets the bottom border for cell one in the first column of the table to a dashed line style.

With ActivePresentation.Slides(2).Shapes(5).Table.Columns(1) _


    .Borders(ppBorderBottom).DashStyle = msoLineDash

End With

Use the Shape property to access the Shape object and to manipulate the contents of each cell. This example deletes the text in the first cell (row 1, column 1), inserts new text, and then sets the width of the entire column to 110 points.

With ActivePresentation.Slides(2).Shapes(5).Table.Cell(1, 1)


    .Shape.TextFrame.TextRange.Text = "Rooster"

    .Parent.Columns(1).Width = 110

End With