excel vba‎ > ‎

VBA - Clear empty rows

posted Feb 3, 2011, 3:27 PM by Roberto Felicini   [ updated Feb 3, 2011, 3:40 PM ]
' clear the empty cells
L1 = ActiveSheet.Cells(65536, 1).End(xlUp).Row
L2 = Cells.SpecialCells(xlCellTypeLastCell).Row
Rows(L2).Select
L3 = L1 + 1
Do Until L1 = L2
Range(Cells(L3, 1), Cells(L2, 1)).EntireRow.Select
Selection.EntireRow.Delete
Range("a1").Select
ActiveSheet.UsedRange.Select
L2 = Cells.SpecialCells(xlCellTypeLastCell).Row
Loop
Comments