How to delete blank rows in excel using VBA

preview_player
Показать описание
how to delete blank rows in excel using VBA?
In this video, you will learn how to delete a blank row in excel using VBA?

Sub Delete_Blank_Row()
Dim iRow As Integer
Dim lRow As Integer

'for find the last non-blank-row on the sheet
lRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row

'Applying reverse loop for this task
For iRow = lRow To 2 Step -1
If Sheet1.Range("A" & iRow).Value = "" Then
Sheet1.Rows(iRow).Delete
End If
Next iRow
MsgBox "Blank rows have been deleted.", vbInformation
End Sub

Website name
AVIT Guru

Website URL

Registration Form

Course URL
Advanced Excel & MIS

VBA Macro Automation

MS Access Database
Рекомендации по теме