deleting blank rows

Joined
Aug 10, 2005
Messages
17
Reaction score
0
Hello All,

I have been using the excellent help and free code available out there to perform certain tasks (a big thank you to all the MVP's who have such web pages available), one I am using from this site:

http://www.cpearson.com/excel/deleting.htm

is as follows:

Public Sub DeleteBlankRows()

Dim R As Long
Dim C As Range
Dim Rng As Range

On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
For R = Rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(Rng.Rows(R).EntireRow) = 0 Then
Rng.Rows(R).EntireRow.Delete
End If
Next R

EndMacro:

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub


and I am using it with the following spreadsheet:


http://www.savefile.com/files/9158310http://www.savefile.com/files/5766611

But it doesnt seem to work - only (old) row 2 gets deleted, but other blank rows remain - can anyone understand why or suggest their own row deleting macro?

Regards,
Jaime.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top