Search code examples
excelvbarow

Remove all completely blank rows


I have a couple thousand rows in a workbook.

There are several hundred rows that are blank.

How can I remove every entirely blank row?


Solution

  • There are two ways to do that:

    1. With VBA:

    There is a VBA script here in this link. Use the first script, I mean DeleteBlankRows.

    You can also copy the same code from here.

    How to use:

    Copy the code.
    In Excel press Alt + F11 to enter the VBE.
    Press Ctrl + R to show the Project Explorer.
    
    Insert -> Module.
    Paste code.
    Save and Exit VBE.
    

    Run the code:

    Select the column with blank rows.
    Press Alt + F8 to open the macro dialog box.
    Select DeleteBlankRows
    Click Run.
    

    2. Without VBA:

    Just check the link here. It is easy so no need to explain again here.