View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Charlotte Howard Charlotte Howard is offline
external usenet poster
 
Posts: 37
Default Delete blank rows

Hi Gary,
Yes, the range was named, and this has worked a treat!
Thank you for your help,
Charlotte

"Gary''s Student" wrote:

Sub rowkiller()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If Not Intersect(Cells(i, 1), Range("address_block")) Is Nothing Then
If IsEmpty(Cells(i, 1)) Then
Rows(i).Delete
End If
End If
Next
End Sub

This assumes that the Named Range has already been established on the
worksheet.
--
Gary''s Student - gsnu200807


"Charlotte Howard" wrote:

Hi Gary, that works well, but can I make it for a named range of cells?

The Cells I need to delete will be located around A10:A15 ( I have named
them address_block- and there will be blank cells above and below this range
which need to remain in place for formatting purposes.

C

"Gary''s Student" wrote:

Try this small macro:

Sub rowkiller()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 1 Step -1
If IsEmpty(Cells(i, 1)) Then
Rows(i).Delete
End If
Next
End Sub
--
Gary''s Student - gsnu200807