View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
The Excelerator[_2_] The Excelerator[_2_] is offline
external usenet poster
 
Posts: 5
Default Do until loop with use of another macro in loop

Thanks Tom. I'll give it a go and hopefully remember to post you a rating
and a thanks again. Just a note : in this example you are correct in assuming
that its output sequentially going down column C.
When my other macros call up a 2nd macro, the auto written code within the
1st macro appears as :
Application.Run "RandomNumber"

Will my brand new macro need to have this call made as above or in your case
how does it know that RandomNumber is the macro to be called.

Sorry still learning (although I thought I was good at this)

JOHN

"Tom Ogilvy" wrote:

Sub ABC()
Range("A1").Formula ="=Countif(Sheet2!C:C,7)"
do while Range("A1") < 10
RandomNumber
Loop
End Sub

Assumes RandomNumber lists its output sequentially going down column C of
Sheet2. If not, then macro ABC would need to know where to look for the
results and maintain the count of 7's as well.

--
Regards,
Tom Ogilvy


"The Excelerator" wrote:

I am searching for some simple code to run a macro for a Do .. While loop,
where it continues to activate another macro event until a certain cell
reaches a predetermined count value.
For example ... lets say we run a rand number generator that copies the
generated diigt to a list (using an absolute copy paste to another location)
- under a separate macro (macro "RandomNumber") - and a cell (A1) counts the
number of 7's that appear. When it reaches the count of TEN appearances, then
the loop ceases and thus the macro RandomNumber" also ceases, until next
activated.