ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Macro until a condition is met (https://www.excelbanter.com/excel-programming/353202-run-macro-until-condition-met.html)

tx12345[_12_]

Run Macro until a condition is met
 

Hi

Let's say I have a little macro that generates a short random row of
numbers. In another cell there is a formula that sees if a particular
condition is met with the lately created string by the marco.

The next item of business is to store the string *if* the condition is
met.

But let's say I need my 'storage' list to have at least 20 rows of
qualified strings, assuming not every string evaluated will qualify for
storage.

Is there a way to tell the macro "keep going until there are 20 rows of
data"?

Thx


tx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=511963


Don Guillett

Run Macro until a condition is met
 
Look in vba help index for LOOP. try something like

do until counter =20

loop

--
Don Guillett
SalesAid Software

"tx12345" wrote in
message ...

Hi

Let's say I have a little macro that generates a short random row of
numbers. In another cell there is a formula that sees if a particular
condition is met with the lately created string by the marco.

The next item of business is to store the string *if* the condition is
met.

But let's say I need my 'storage' list to have at least 20 rows of
qualified strings, assuming not every string evaluated will qualify for
storage.

Is there a way to tell the macro "keep going until there are 20 rows of
data"?

Thx


tx


--
tx12345
------------------------------------------------------------------------
tx12345's Profile:
http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=511963




tx12345[_13_]

Run Macro until a condition is met
 

OK, i've got:

Sub store

Do counter = 20

Application.Run "xzy!store1"

loop

end sub

but it runs on into infinity. any way to tell it to stop when Cell C1
for example, says 20?

thx

t

--
tx1234
-----------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...fo&userid=2477
View this thread: http://www.excelforum.com/showthread.php?threadid=51196



All times are GMT +1. The time now is 01:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com