You can use below VBA code to Delete Blank Rows from Active worksheet.
Sub Delete_Blank_Rows()
'Step1: Declare your variables.
Dim MyRange As Range
Dim iCounter As Long
'Step 2: Define the target Range.
Set MyRange = ActiveSheet.UsedRange
'Step 3: Start reverse looping through the range.
For iCounter = MyRange.Rows.Count To 1 Step -1
'Step 4: If entire row is empty then delete it.
If Application.CountA(Rows(iCounter).EntireRow) = 0 Then
Rows(iCounter).Delete
End If
'Step 5: Increment the counter down
Next iCounter
End Sub
No comments:
Post a Comment