Delete all the rows in a spreadsheet except

Closed
Toto - Mar 18, 2012 at 03:19 PM
venkat1926 Posts 1864 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Mar 18, 2012 at 10:26 PM
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

venkat1926 Posts 1864 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 810
Mar 18, 2012 at 10:26 PM
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
0