ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting alternative rows (https://www.excelbanter.com/excel-programming/396216-deleting-alternative-rows.html)

Curt J[_2_]

Deleting alternative rows
 
I have region containing roughly 100 rows. I would like to create a macro
that deletes every other row within the region. I would like to start by
deleting row 2 & then continue to do so for the rest of the region.

Please advise.

Thanks

Don Guillett

Deleting alternative rows
 
try this
Sub deleteeveryotherrow()
For i = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -2
Rows(i).Delete
Next i
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Curt J" <Curt
wrote in message
...
I have region containing roughly 100 rows. I would like to create a macro
that deletes every other row within the region. I would like to start by
deleting row 2 & then continue to do so for the rest of the region.

Please advise.

Thanks



Curt J

Deleting alternative rows
 
Perfect, thanks for the help Don.

"Curt J" wrote:

I have region containing roughly 100 rows. I would like to create a macro
that deletes every other row within the region. I would like to start by
deleting row 2 & then continue to do so for the rest of the region.

Please advise.

Thanks


Don Guillett

Deleting alternative rows
 
Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Curt J" wrote in message
...
Perfect, thanks for the help Don.

"Curt J" wrote:

I have region containing roughly 100 rows. I would like to create a
macro
that deletes every other row within the region. I would like to start by
deleting row 2 & then continue to do so for the rest of the region.

Please advise.

Thanks




All times are GMT +1. The time now is 10:03 PM.

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