Delete all the rows in a spreadsheet except

[Closed]
Report
-
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
-
Hello,

I have a simple question. How to delete all the rows in a spreadsheet except the first 6 rows by macro. Please reply me with an exact code to do this.

1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
802
why do you want a macro. just delete rows 7 to the end

anyhow try this macro

range(range("A1"),cells(rows.count,"A").end(xlup).entirerow.delete