This Excel Macro will go through all the cells in column A, find the last cell that has data in it, and then delete every other row in that data range.
To Delete Odd Rows
Sub Delete_Odd() Application.ScreenUpdating = False lr = Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row If lr Mod 2 = 0 Then lr = lr - 1 End If For i = lr To 1 Step -2 Rows(i & ":" & i).Delete Shift:=xlUp Next i Application.ScreenUpdating = True End Sub
To Delete Even Rows
Sub Delete_Even() Application.ScreenUpdating = False lr = Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row If lr Mod 2 = 0 Then Else lr = lr - 1 End If For i = lr To 1 Step -2 Rows(i & ":" & i).Delete Shift:=xlUp Next i Application.ScreenUpdating = True End Sub
Posted by Excel Instructor:
https://www.chicagocomputerclasses.com/excel-classes/