[英]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. 我创建了一个名为“ valtable2”的表,并且试图删除其中一个单元格中的文本。
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. 单元已被选中,但不会删除。
Try to avoid using Select
where possible. 尽量避免使用“
Select
。 You could just set the cell value to nothing: 您可以将单元格值设置为空:
valtable2.Cell(2, 1).Range.Text = ""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.