View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Wigi Wigi is offline
external usenet poster
 
Posts: 396
Default deleting the blank rows from the sheet

Personally, I would use:

Sub surface()

Dim rng As Range

Set rng = Application.Intersect(Cells.Columns(1), ActiveSheet.UsedRange)

On Error Resume Next
rng.SpecialCells(xlCellTypeBlanks).EntireRow.Delet e
On Error GoTo 0

End Sub


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Mike H" wrote:

Hi,

I have assumed that if the cell in column A is empty then this identifies a
blank row. If that is correct then right click the sheet tab, view code and
paste this in:-

Sub surface()
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

For x = LastRow To 1 Step -1
Cells(x, 1).Select
If Cells(x, 1).Value = "" Then
Selection.EntireRow.Delete
End If
Next
End Sub

Mike