Data Tools · VBA

Delete Blank Rows

Remove every empty row from the active sheet.

download.bas (ES) download.bas (EN)
' Deletes every fully-blank row in the used range of the active sheet.
Sub DeleteBlankRows()
    Dim ws As Worksheet, r As Long, lastRow As Long
    Set ws = ActiveSheet
    lastRow = ws.UsedRange.Rows(ws.UsedRange.Rows.Count).Row
    Application.ScreenUpdating = False
    For r = lastRow To 1 Step -1
        If Application.WorksheetFunction.CountA(ws.Rows(r)) = 0 Then ws.Rows(r).Delete
    Next r
    Application.ScreenUpdating = True
    MsgBox "Blank rows removed.", vbInformation
End Sub

Free to use and modify · ExcelBot — excelempowers.com

Scans the used range and deletes any row that is completely empty.

How to install:

  1. Open your workbook and press Alt + F11 to open the VBA editor.
  2. Choose Insert ▸ Module and paste the code (or File ▸ Import File for the .bas).
  3. Press F5 to run, or run it from Developer ▸ Macros.
  4. Save your file as .xlsm (macro-enabled) to keep the macro.

No VBA? In ExcelBot you can do the same thing by just asking the AI in plain language.

delete blank rows clean empty filas vacías limpieza
Rather not use VBA?

In ExcelBot you get the same result by asking the AI in plain language — no macros needed.

Try ExcelBot free Browse more macros

Related macros