PDA

View Full Version : automatic removal of empty rows



Lichress
04-08-2017, 01:39 AM
Hello,tell, please, it is possible to create such macro для removal empty rows?

Logit
04-09-2017, 04:55 PM
.
.
Paste into a Routine Module, activate from command button on sheet :




Sub DeleteBlankRows1()


'Deletes the entire row within the selection if the ENTIRE row contains no data.
'http://www.ozgrid.com/VBA/VBACode.htm




'We use Long in case they have over 32,767 rows selected.


Dim i As Long


'We turn off calculation and screenupdating to speed up the macro.


With Application


.Calculation = xlCalculationManual


.ScreenUpdating = False


'We work backwards because we are deleting rows.


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

Lichress
04-10-2017, 11:19 AM
thanks

Logit
04-10-2017, 11:35 AM
You are welcome !

Cheers.