In this article we will learn how to delete the rows when there is no data in whole row.
Following is the snapshot of data we have:
The concept behind this tutorial is if there is any complete blank row found in the selected range A1:E10 then the vba code should delete that row.
We need follow the below steps:
Sub DeleteEntireRow()
Dim i As Long
'Calculation and Screenupdating is turn off to speed up the macro
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
For i = Selection.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
In this way we can delete rows using vba in Microsoft excel.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.