ExcelBanter

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

yaniv_av

deleting rows
 

Hi,

I need a code that deletes all the odd/even rows in a sheet.

10X !


--
yaniv_av
------------------------------------------------------------------------
yaniv_av's Profile: http://www.excelforum.com/member.php...o&userid=26558
View this thread: http://www.excelforum.com/showthread...hreadid=398317


David McRitchie

deleting rows
 

Delete All Even Numbered Rows (#DelEvenRows)
http://www.mvps.org/dmcritchie/excel/delempty.htm

Perhaps this could be done without a loop but here is one way.

Sub DelEvenRows()
'David McRitchie 2002-03-11 misc
'Delete Even numbered rows from the bottom
Application.ScreenUpdating = False
Dim ix As Long
For ix = Cells.SpecialCells(xlLastCell).Row To 2 Step -1
If ix Mod 2 = 0 Then Rows(ix).Delete
Next ix
Application.ScreenUpdating = True
End Sub


--
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"yaniv_av" wrote in message
...

Hi,

I need a code that deletes all the odd/even rows in a sheet.

10X !


--
yaniv_av
------------------------------------------------------------------------
yaniv_av's Profile: http://www.excelforum.com/member.php...o&userid=26558
View this thread: http://www.excelforum.com/showthread...hreadid=398317





All times are GMT +1. The time now is 03:57 AM.

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