Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how to stop a loop

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default how to stop a loop

Hi
exit for


--
Regards
Frank Kabel
Frankfurt, Germany

"L775" schrieb im Newsbeitrag
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how to stop a loop


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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default how to stop a loop

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/groups?threadm=eZv...GP15.phx.g bl

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

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"L775" wrote in message ...

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.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default how to stop a loop

Hi,

how about

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

Steve
"David McRitchie" wrote in message
...
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/groups?threadm=eZv...GP15.phx.g bl

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

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"L775" wrote in message
...

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.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default how to stop a loop

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.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Steve Smallman" wrote in message ...
Hi,

how about

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

Steve
"David McRitchie" wrote in message
...
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/groups?threadm=eZv...GP15.phx.g bl

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

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"L775" wrote in message
...

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.








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default how to stop a loop

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?
.

Thanks

"L775" wrote:


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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop a loop when certain data is found jsmith Excel Discussion (Misc queries) 3 June 2nd 08 10:12 PM
How do I stop other circles in other cells to stop selecting? stauff Excel Worksheet Functions 2 October 29th 04 09:02 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM
Stop a loop with a keyboard Fernando Ortiz Excel Programming 1 November 22nd 03 03:39 AM
newbie: stop a FOR NEXT loop Mike H[_7_] Excel Programming 4 October 11th 03 04:47 PM


All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"