Need help with simple macro that ends when a cell reaches a set value

AllenB

Member
I need to be able to stop a macro when the Game count reaches a fixed amount.
The Macro here is running 2 applications called "Combo_Hits" and Matrix_Position_Hits" that I created using steps.
I would like to be able to start back any number of games I choose and have the macro stop when that number reaches 0
My fingers get tired holding down the buttons and you can only duplicate the application a certain amount.
I want to be able to walk away while the data is generated.
Thanks
 

Frank

Member
This promps some supplementary questions, since this would go haywire without clear details.

1. This game counter cell, can I assume that it will reduce by one by your macros after they run?

2. can I assume that it will step by itself to the next game position , ready to go' after your two macros run ?

If so, you just need a do while loop looking at your game counter cell.

If not, it requires a built in counter, and may need a stepping mechanism built in to move it to the next game.

Thanks

Frank
 

AllenB

Member
Counter and Advance are in the Step Macros. Just Need it to Loop. The Cell to be tested is B1 and has a range Name "_Game"
 

Frank

Member
I tested this out but had to build in a counter in my test version, which has now been removed.

Try this macro:-


Sub countdown() 'change this to anything you like

Dim i As Integer

i = Range("_Game").Value

Do While i > 0

Combo_Hits

Matrix_Position_Hits

i = Range("_Game").Value

Loop

End Sub

' end of the macro

Before testing any looping macros, save your original sheet under a new name as a backup first, be ready to press 'escape' should the macro not terminate.
 

AllenB

Member
Is this a separate Macro or does it go into the Macro i want to run. This looks like it stands alone and runs the 2 Applications by itself.
 

Frank

Member
Yes it's a stand alone macro, calling on your macros within it. Normally I would link it to a button.
 

AllenB

Member
Works like a Charm. Thank you very much. Now I can get some exercise while I run Mass Quantities of Data, so that the time won't be wasted when the results are No Good.
Thank You Very Much Frank.
 

Sidebar

Top