0

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.

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
Andy Wang
  • 11
  • 1
  • Possible duplicate of [How to delete cell contents in Word with VBA?](https://stackoverflow.com/questions/5878294/how-to-delete-cell-contents-in-word-with-vba) – FAB Jun 24 '19 at 18:25
  • The answer in the linked post encourages the use of Select, which can be avoided in this instance – bm13563 Jun 24 '19 at 19:07

1 Answers1

1

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

valtable2.Cell(2, 1).Range.Text = ""
bm13563
  • 688
  • 5
  • 18