View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Ginny Ginny is offline
external usenet poster
 
Posts: 11
Default Delete Blank Rows

This always works well for me:

Sub DeleteBlankRows1()
'Deletes the entire row within the selection if the ENTIRE row contains no
data.

'We use Long in case they have over 32,767 rows selected.
Dim i As Long

'We turn off calculation and screenupdating to speed up the macro.
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False

'We work backwards because we are deleting rows.
For i = Selection.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i

.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub


"Heather" wrote:

Hi, I need to find a way to delete wholly blank rows from a spreadsheet that
also includes blank cells.
I tried F5special...radio button BlanksOK ctrl+- delete rows , but that
also deletes rows that have data in them along with a blank cell!

Is there an equally neat way of deleting rows that have no data in them at
all, but leaving partial rows?