VBA Excel - Apague células vazias - Delete Empty Rows

Inline image 1

Como posso apagar células vazias na minha planilha?

Sub Del_Empty_Rows()
Dim R As Long
Dim rng As Range
Application.ScreenUpdating = False
 
If Selection.Rows.Count > 1 Then
   Set rng = Selection
Else
   Set rng = ActiveSheet.UsedRange.Rows
End If
 
For R = rng.Rows.count To 1 Step -1
   If WorksheetFunction.CountA(rng.Rows(R).EntireRow) = 0 Then
      rng.Rows(R).EntireRow.Delete
   End If
Next R
 
Application.ScreenUpdating = True
End Sub

Reference:
Inspiration:

Tags: VBA, Excel, delete, cells, cell, apaga, célula