top of page

Filtering out blank rows


Bugmonsta has posted a useful VBA code here, that you can use to filter out rows in an Excel area that are completely blank.

Sub Macro1() ' ' Macro1 Macro

Rows("1:1").Select Selection.AutoFilter ActiveSheet.Range("$A$1:$F$15").AutoFilter Field:=1, Criteria1:="<>" Range("A1").Select End Sub

In this example we have a spreadsheet with data that includes some blank rows.

Press ALT + F11 to go into Visual Basic, and insert the code in a new module:

You'll need to edit the code so the ActiveSheet.Range specified matches the data on your worksheet.

Run the macro and all rows in the array which are entirely blank will be filtered out.


bottom of page