Reply
Fri 1 Jul, 2016 03:59 am
Hello everyone, I am a regular user of Microsoft Excel with VBA and have a very good understanding of the program. However, in my latest worksheet, I have stumbled upon an irritating issue, which I can’t seem to resolve. I have a worksheet that consist of over 10,000 rows of data. But the sheet also has many blank rows at random places which I need to eliminate. I have tried every formula and function I can think of but none worked. I was hoping I could find the necessary VBA code here, so if anyone can, please help me to delete all the blank rows from my worksheet with the help of VBA code.
@arbindgaba,
If you sort the data on any field, the blanks will drop to the bottom. I would try that before going the VBA route.
@engineer,
If you want to use VBA, you could use this. Be sure to put the work "stop" in column A at the end and save a copy in case it doesn't work the way you want.
Code:Public Sub DeleteEmptyRows()
Range("a1").Select
Do While ActiveCell.Value <> "stop"
If ActiveCell.Value = Empty Then
Rows(ActiveCell.Row).Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub