ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select and Delete Every Other Row in Excel Sheet (https://www.excelbanter.com/excel-programming/356340-select-delete-every-other-row-excel-sheet.html)

Sawyer

Select and Delete Every Other Row in Excel Sheet
 
Hello all

Need to find a Script that would Delete every other row in Excel say starting at Row A1 to Row A100 it would delete A2,A4,A6 and so on

Thanks

Scott


Yngve

Select and Delete Every Other Row in Excel Sheet
 
hi
somthing like this, delete every scecond row

Sub DeleteRows()
Dim i As Long, lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lastrow Step 2

Rows(i).Delete

Next


End Sub

Regards Yngve


Tom Ogilvy

Select and Delete Every Other Row in Excel Sheet
 
for i = 100 to 1 step -2
rows(i).Delete
Next

--
Regards,
Tom Ogilvy



"Sawyer" wrote:

Hello all

Need to find a Script that would Delete every other row in Excel say starting at Row A1 to Row A100 it would delete A2,A4,A6 and so on

Thanks

Scott


Sawyer

Select and Delete Every Other Row in Excel Sheet
 
I like this one straight to the point and easy to change

"Tom Ogilvy" wrote in message
...
for i = 100 to 1 step -2
rows(i).Delete
Next

--
Regards,
Tom Ogilvy



"Sawyer" wrote:

Hello all

Need to find a Script that would Delete every other row in Excel say
starting at Row A1 to Row A100 it would delete A2,A4,A6 and so on

Thanks

Scott





All times are GMT +1. The time now is 09:31 PM.

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