View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers,microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default help delete blank rows

Two subs that delete blank rows Cletus

First sub:
If your selection have 1 Row it will run it for the Usedrange
If your selection have more then 1 Row it will use that range

The Second sub will use the UsedRange


Public Sub DeleteRealyBlankRows()
'Chip Pearson
Dim R As Long
Dim C As Range
Dim N As Long
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
N = 0
For R = rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(rng.Rows(R).E ntireRow) = 0 Then
rng.Rows(R).EntireRow.Delete
N = N + 1
End If
Next R
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub


Sub DeleteEmptyRows()
'JW
LastRow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For R = LastRow To 1 Step -1
If Application.CountA(Rows(R)) = 0 Then Rows(R).Delete
Next R
End Sub



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Cletus Stripling" wrote in message ...
I have a spreadsheet with a blank row between each row of good data. What is
the best way to quickly eliminate all these blanks?

Could this be easily done?

Sampel Data

Col A
John
blank
Sue
blank
*
*
*
Kim
blank
Sally