Andy Wang
Andy Wang

Reputation: 11

Deleting a cell in a table in Word VBA

I have created a table called "valtable2" and I am trying to delete the text in one of the cells.

With valtable2
  .Cell(2, 1).Select
  Selection.Delete
End With
With valtable2
  .Cell(2, 1).Select
  Selection.Delete
End With

The cell is being selected, but it doesn't delete.

Upvotes: 0

Views: 142

Answers (1)

bm13563
bm13563

Reputation: 698

Try to avoid using Select where possible. You could just set the cell value to nothing:

valtable2.Cell(2, 1).Range.Text = ""

Upvotes: 1

Related Questions