Thread: Looping issue
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
davidm davidm is offline
external usenet poster
 
Posts: 1
Default Looping issue


As a mental exercise, I wish to employ straight-down (as opposed t
back-up) loop to delete blank rows. Further, I wish to deploy
construct where all cells that qualify (ie blank) are agglomorated an
deleted in one fell swoop at the end of the looping. As the code wil
not be repeatedly deleting during passes in the loop, some preciou
time will be gained to improve time efficiency. My effort thus far ha
produced the following code which fails to "gather" the qualifyin
cells.

Sub DeleteBlankrw()
Dim rng As Range
Dim c As Range
For Each c In Range("a1:a" & [a65536].End(xlUp).Row)
If IsEmpty(c) Then
Set rng = c
Set x = Union(rng, c)
End If
Next
MsgBox x.Address
x.Delete
End Sub

Any help will be appreciated

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=39389