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 simple loop macro

Just to add some explanation to you current code.
a1 doesn't refer to Range("A1")

Sub Macro2()

Do While isempty(Range("a1"))
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Loop

End Sub

--
Regards,
Tom Ogilvy


"jim27" wrote in message
...

Hi all

I am complete novice when it come to macros in excel but I am trying to
learn! I have been trying to get a loop macro to work to delete cells
which are blank. But it just keeps deleting and does not stop when
there is some content in the cell.
HEre is the code! What am I doing wrong?

Sub Macro2()

Do
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Loop Until a1 0

End Sub


--
jim27


------------------------------------------------------------------------
jim27's Profile:

http://www.excelforum.com/member.php...o&userid=15379
View this thread: http://www.excelforum.com/showthread...hreadid=269967