Delete Rows

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.
 
E

edvwvw via OfficeKB.com

bk2003 said:
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.


Which rows do you wan to keep?

edvwvw
 
D

Don Guillett

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
 
B

bk2003

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
 
B

bk2003

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!
 
Top