Hi Gord,
I saw your solution but didn't understand it at first. I don't use VBA
frequently enough to be able to quickly grasp new routines. So I played
with your excellent routine to learn and understand.
I changed it a bit to the following as I was playing with it.
Sub DeleteEmptyRows()
'\ only if entire row is blank
Dim lStartRow As Long
Dim lUsedRows As Long
Dim lEndRow As Long
Dim lCounter As Long
Application.ScreenUpdating = False
lStartRow = ActiveSheet.UsedRange.Row - 1
lUsedRows = ActiveSheet.UsedRange.Rows.Count
lEndRow = lStartRow + lUsedRows
For lCounter = lEndRow To lStartRow Step -1
If Application.CountA(Rows(lCounter)) = 0 Then Rows(lCounter).Delete
Next lCounter
End Sub
Do you see any bugs in it? Where I think it might be a slight improvement
over your earlier version is your loop. You loop back from the final row to
"1". But if the data doesn't begin at row1, there is no need to go back to
it.
I suspect this is probably pendantic, as it will go through the beginning
blank lines very quickly anyway. I had to "break it down" so I properly
understood how your LastRow worked. Once I did that, I just changed your
routine slightly.
If you think this is okay, I will be adding your routine to my "library" of
routines. It seems to work fine in my little test trials.
Thank you Gord.
Best regards,
Kevin
Gord Dibben...