Delete every other row in a 2007 spreadsheet

  • Thread starter Thread starter Legal Learning
  • Start date Start date
L

Legal Learning

I need to delete every other row in a 2000 row Excel 2007 spreadsheet. Could
someone help me with the code with this. I am ok with Word VBA but NOT Excel.


Thanks!
 
Sub deleteAlternatingRows()

For i = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -2
Rows(i).Delete
Next i

End Sub
 
This is REALLY easy w/o VBA...

Use a helper (blank) column, insert a column if you'd like
At the start of your data (assuming you are not skipping blank rows, if so,
this isn't for you) put this formula =MOD(ROW(),2)
Copy down your entire data set
Filter on that column (Home tab | Editing group | Sort & Filter button) for
whichever odd/even row you want to delete (0 or 1)
Select the visible rows
Hit Ctrl + - (that is a minus sign)
Confirm delete entire row
Delete helper column

HTH
 
Back
Top