Macro to Delete Rows in Excel


Delete blank Rows in between rows containing data


Sub DeleteRows()
Range("A2").Select
Do Until ActiveCell.Offset(1, 0).Value = ""
Selection.EntireRow.Delete
ActiveCell.Offset(1, 0).Select
Loop
End Sub

Delete blank Rows (2 rows each) in between rows containing data


Sub Delete2Rows()
Range("A2").Select
Do Until ActiveCell.Offset(2, 0).Value = ""
Selection.EntireRow.Delete
Selection.EntireRow.Delete
ActiveCell.Offset(1, 0).Select
Loop
End Sub


How to use codes shared here?

Leave a Reply

Your email address will not be published.Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.