ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete Rows (https://www.excelbanter.com/excel-discussion-misc-queries/189779-delete-rows.html)

bk2003

Delete Rows
 
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.

edvwvw via OfficeKB.com

Delete Rows
 
bk2003 wrote:
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200806/1


Don Guillett

Delete 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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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.



bk2003

Delete Rows
 
I would like to keep every 5th row (i.e. rows 1, 6, 11, 16)

"edvwvw via OfficeKB.com" wrote:

bk2003 wrote:
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200806/1



bk2003

Delete Rows
 
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

"Don Guillett" wrote:

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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.




Don Guillett

Delete Rows
 
If you're new to macros, you may want to read David McRitchie's intro
at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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

"Don Guillett" wrote:

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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.





bk2003

Delete Rows
 
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!

"Don Guillett" wrote:

If you're new to macros, you may want to read David McRitchie's intro
at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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

"Don Guillett" wrote:

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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.





Don Guillett

Delete Rows
 
I assumed a header in row 1

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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!

"Don Guillett" wrote:

If you're new to macros, you may want to read David McRitchie's
intro
at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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

"Don Guillett" wrote:

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"bk2003" wrote in message
...
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.






David Biddulph[_2_]

Delete Rows
 
Use a helper column with =MOD(ROW(),5)=1, and filter by that.
--
David Biddulph

"bk2003" wrote in message
...
I would like to keep every 5th row (i.e. rows 1, 6, 11, 16)

"edvwvw via OfficeKB.com" wrote:

bk2003 wrote:
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200806/1






All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com