如何在表格的第二行上方添加一行? Excel VBA

时间:2016-11-14 18:43:14

标签: excel vba excel-vba

默认情况下,会在下面添加行。在上面添加行但是没有使用ListObjects的SO上有很多答案。我很感激帮助。

Private Sub CommandButton1_Click()

Dim the_sheet As Worksheet
Dim table_list_object As ListObject
Dim table_object_row As ListRow

Set the_sheet = Sheets("Decision Log")
Set table_list_object = the_sheet.ListObjects(1)
Set table_object_row = table_list_object.ListRows.Add(1)

End Sub

1 个答案:

答案 0 :(得分:1)

这应该适合你:

Set table_object_row = table_list_object.ListRows(1).Range.EntireRow.Insert