Skip to content

How to delete every other row in Excel?

  • by
  • 3 min read

Microsoft Excel offers powerful tools for organising and manipulating data; at times, you may need to streamline your dataset by removing every other row. This process is particularly useful when you have large datasets and wish to reduce their size while retaining essential information.

This article discusses how to delete every other row in Excel using the macro in a few simple and easy steps.

Also read: How to delete hidden rows in Excel?

Delete every other row using the macro

Automating the deletion of every other row in Excel is possible through Macros. Macros serve as recorded instructions to carry out repetitive tasks automatically. Follow these steps to simplify and automate the process of deleting every other row in Excel:

Step 1: Open the worksheet on your PC and press Alt + F11 to launch the Visual Basic for Applications window.

Step 2: In the Visual Basic for Applications window, click on the Insert tab in the menu bar at the top.

Step 3: In the menu, click on the Module option.

Step 4: In the module code window copy and paste the following code in the code window:

Sub Delete_Alternate_Rows_Excel()
  Dim SourceRange As Range

  Set SourceRange = Application.Selection
  Set SourceRange = Application.InputBox("Range:", "Select the range", SourceRange.Address, Type:=8)

  If SourceRange.Rows.Count >= 2 Then
    Dim FirstCell As Range
    Dim RowIndex As Integer

    Application.ScreenUpdating = False

    For RowIndex = SourceRange.Rows.Count - (SourceRange.Rows.Count Mod 2) To 1 Step -2
      Set FirstCell = SourceRange.Cells(RowIndex, 1)

    Application.ScreenUpdating = True

  End If
End Sub

Step 5: Press the F5 key on your keyboard to run the macro. Alternatively, you can click on the Run tab in the menu bar.

Step 6: Click on the Run Sub/UseForm option in the menu.

Step 7: Select the range dialogue box that will pop up. Go back to the worksheet.

Step 8: Select your data and click on the OK button.

Step 9: Every other row will be deleted, and all the remaining rows will fill the gaps. You can close the Visual Basic for Applications window.

Also read: How to add a text box in Word?

Akash Singh

Akash Singh

Akash is a law graduate who likes to go for bike rides on the weekends soul-searching for answers to his many existential questions. You can contact him here: