how to stop a loop

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I stop iteration when it reaches the end of a group of occupied cells
filled with the same text (i.e. B277) in a column?

Thanks
 
I want it to stop at the end of the list. who does it know that the next
cell is empty so it will not error or use an empty cell.
the length of the list in a column or number of rows varies for different
groups that the routine or loop neet to operate on. thank you for your help.
I know there is a way of doing.
 
To have the programming work similar to doubleclick on the fill handle
so that it copies down until the next cell is empty requires a Tom Ogilvy
solution.
http://google.com/[email protected]

The macro equivalent ( SUB ) to double-click.
Dim rng as Range
set rng = Range(cells(2,1),cells(2,1).End(xldown))
rng.offset(0,1).Formula = Cells(2,2).Formula
 
Hi,

how about

do until activecell.offset (0,1).value =""
'code
activecell.offset(1,0).select
Loop

Steve
 
Wouldn't work same. A formula could be returning a null value,
Tom's code has no loop, much faster, and works same as
the worksheet function would for a selection from Column A.
Other columns would check the column to the left instead of
to the right.

BTW, changing the activecell is not a good practice within a macro
except upon exiting and only if that was the purpose of the macro.

However there are many ways to solve a problem and knowing
your data is always important.
 
Hi L775,

At the top of the loop:
Do until activecell.value = ""

You did a post on 11/25/04 where you indicated that you might be interested
in a programmer to do freelance projects. Are you still interested?
(e-mail address removed).

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top