Delete all data rows from an Excel table (apart from the first)

后端 未结 9 2153
执笔经年
执笔经年 2020-12-01 09:16

Just recently I\'ve been trying to delete all data rows in a table, apart from the first (which needs to just be cleared)

Some of the tables being actioned could alr

9条回答
  •  一生所求
    2020-12-01 10:08

    Would this work for you? I've tested it in Excel 2010 and it works fine. This is working with a table called "Table1" that uses columns A through G.

    Sub Clear_Table()
        Range("Table1").Select
        Application.DisplayAlerts = False
        Selection.Delete
        Application.DisplayAlerts = True
        Range("A1:G1").Select
        Selection.ClearContents
    End Sub
    

提交回复
热议问题