Live Interactive Virtual LearningLive interactive virtual classes are available for our public scheduled courses as well as group or in-house training requests.
Experience training in the comfort of your home or office!
To delete empty rows in a selected range we can use the following macro. The macro here uses the For Next Loop. First the macro counts the rows in a selected range to determine the when the macro should stop. The For Next statement acts as a counter.
Rng = Selection.Rows.Count
Application.ScreenUpdating = False
For i = 1 To Rng
If ActiveCell.Value = "" Then 'You can replace "" with 0 to delete rows with 'the value zero
Application.ScreenUpdating = True
The statement "Application.ScreenUpdating = False" prevents the screen from updating to ensure the macro runs faster and the screen will not flicker. Don't forget to set it back to "True".