View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Masked Coder[_7_] Masked Coder[_7_] is offline
external usenet poster
 
Posts: 1
Default select alternate rows - quickly

Try this instead:

Code
-------------------

Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For row_index = lastrow To 1 Step -1
If IsEven(row_index) = False Then
Rows(row_index).delete
End If
Next
Application.ScreenUpdating = True
End Sub

-------------------



Then add this code to the module


Code
-------------------

Function IsEven(lngNum As Long) As Boolean
IsEven = Not CBool(lngNum Mod 2) 'test
End Function

-------------------


--
Message posted from http://www.ExcelForum.com