View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Deleting empty rows

If you can make the determination on a single column (if a cell in that
column is blank, then delete) and the cells are actually blank, not just
appear blank but contain a formula, and the number of non-contiguous areas
are less thant 8192 you can quickly delete with

On Error Resume Next
Columns(1).Specialcells(xlBlanks).EntireRow.Delete
On Error goto 0

1 specifies column A, adjust as needed.

--
Regards,
Tom Ogilvy


"Ron de Bruin" wrote in message
...
Try this Foss

Sub Example1()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1

If Application.CountA(.Rows(Lrow)) = 0 Then .Rows(Lrow).Delete
'This will delete the row if the whole row is empty (all

columns)

Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Foss" wrote in message

...
Good afternoon all,

Does anyone have something nice and quick that can delete all empty rows

in the UsedRange?

Thanks for your time,
Foss