allanlorriman
asked on
excel delete rows
Hello Experts
I have an excel document of over 4000 rows of data in it, I have to keep every 8th row and delete the rest 1 - 7 rows.
What I mean here is, delete 1 - 7 rows and keep the 8th, and then remove another 7 rows ie: 9-15 and keep the 16 th row and so on..
Is there any way I can automate this in excel? Going through manually would take all my time today..
Please advice?
Thanks
I have an excel document of over 4000 rows of data in it, I have to keep every 8th row and delete the rest 1 - 7 rows.
What I mean here is, delete 1 - 7 rows and keep the 8th, and then remove another 7 rows ie: 9-15 and keep the 16 th row and so on..
Is there any way I can automate this in excel? Going through manually would take all my time today..
Please advice?
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks all for your input,
Kris, your script works when but instead of keeping the 8th row, its keeping the 9th one. This is because an additional header row.
If I change the change the script to
ReDim kk(1 To 1 + UBound(k, 1) \ 9, 1 To UBound(k, 2))
It gives an error..
Please can you advice how can I go about the shifting the row to 9?
Thanks
Kris, your script works when but instead of keeping the 8th row, its keeping the 9th one. This is because an additional header row.
If I change the change the script to
ReDim kk(1 To 1 + UBound(k, 1) \ 9, 1 To UBound(k, 2))
It gives an error..
Please can you advice how can I go about the shifting the row to 9?
Thanks
Did you try mine?
ASKER
Hi Kris
Please see the attached, you are obviously keeping the 9th row but that including the header I would need the 10th row as attached.
Please can you advice?
Hi Martin,
Yes, I did try but again, my bad, I probably not have explained it well. I hope you udnerstand now. Please find attached the highlighted lines I wanted to keep.
Book1.xlsb
Please see the attached, you are obviously keeping the 9th row but that including the header I would need the 10th row as attached.
Please can you advice?
Hi Martin,
Yes, I did try but again, my bad, I probably not have explained it well. I hope you udnerstand now. Please find attached the highlighted lines I wanted to keep.
Book1.xlsb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am getting the following rows without a header row
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
a9 a2 a3 a4 a5 a6 a7 a8 a9 a10
a17 a2 a3 a4 a5 a6 a7 a8 a9 a10
a25 a2 a3 a4 a5 a6 a7 a8 a9 a10
And this with the header
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
a9 a2 a3 a4 a5 a6 a7 a8 a9 a10
a17 a2 a3 a4 a5 a6 a7 a8 a9 a10
a25 a2 a3 a4 a5 a6 a7 a8 a9 a10
Instead of
a9 a2 a3 a4 a5 a6 a7 a8 a9 a10
a18 a2 a3 a4 a5 a6 a7 a8 a9 a10
a27 a2 a3 a4 a5 a6 a7 a8 a9 a10
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
a9 a2 a3 a4 a5 a6 a7 a8 a9 a10
a17 a2 a3 a4 a5 a6 a7 a8 a9 a10
a25 a2 a3 a4 a5 a6 a7 a8 a9 a10
And this with the header
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
a9 a2 a3 a4 a5 a6 a7 a8 a9 a10
a17 a2 a3 a4 a5 a6 a7 a8 a9 a10
a25 a2 a3 a4 a5 a6 a7 a8 a9 a10
Instead of
a9 a2 a3 a4 a5 a6 a7 a8 a9 a10
a18 a2 a3 a4 a5 a6 a7 a8 a9 a10
a27 a2 a3 a4 a5 a6 a7 a8 a9 a10
ASKER
That is it Kris, this seems to have worked on the test file. Thank you so much.
I will check on my document and I hope it works.
Regards
Allan
I will check on my document and I hope it works.
Regards
Allan
ASKER
Thanks for your wonderful help Kris!
Open in new window
Kris