Delete Rows

  • Thread starter Thread starter bk2003
  • Start date Start date
B

bk2003

Is it possible to delete rows by the row number and not by the data inside?
I have 300,000 rows and only want to keep 1 of every 5 rows.
 
something like
Sub deleterows()
For i = Cells(Rows.Count, "a").End(xlUp).Row To 1 Step -5
Rows(i).Offset(1).Resize(4).Delete
Next i
End Sub
 
Where do I put that into Excel? I basically understand what you are telling
me to do, but I just don't know how to put it into Excel to get it to work.
Thanks
 
Thank you. The only part that didn't work perfectly is the first 5 rows.
But, I can easily delete those manually. Thanks for the macros education!
 
Use a helper column with =MOD(ROW(),5)=1, and filter by that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top