In VBA in excel, I want to know how I can automatically remove rows in my spreadsheet table where all the columns in the row are blank. For example If I have a table with four columns from A-D, if a row has all columns blank, then how can I remove it from the table automatically? Is this possible? At the moment nothing is happening with the code I attempted. I am using an MAC EXCEL 2011.
Here is a link to a screenshot on what the table looks like and the code I attempted:
http://www.dropviewer.com/v.php?i=527a411bb8242.png
Here is the code:
Sub RowKiller()
Dim N As Long, i As Long, r As Range
N = Cells(Rows.Count, "B").End(xlUp).Row
Dim wf As WorksheetFunction
Set wf = Application.WorksheetFunction
For i = N To 1 Step -1
Set r = Range("B" & i & ":E" & i)
If wf.CountA(r) = 0 Then
r.EntireRow.Delete
End If
Next i
End Sub
Can somebody provide a sample code for this please?
Bookmarks