View Full Version : Need Help Writing Macro to Simulate Roulette Spins

11-08-2015, 11:05 AM
I'm pretty new to VBA, and can't seem to figure out a method to simulate wins or losses for roulette spins. I generated 10,000 random numbers from 1-38 which are my simulated spins. I have a series of consecutive bets that I would make, and the goal is to continue on this series until a win occurs and then start a second series and so on. For example:

Bet 1: Red --> winning numbers would be 1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36
Bet 2: Corner --> Winning numbers would be 1,2,4,5
Bet 3: Straight Up --> Winning numbers would be 1

So if I lost the first 2 bets and then won on the third bet I want it to identify the win and then start over at bet 1 for the remaining 9,997 numbers.

This is my thought on how to accomplish this, but I don't know how to write a macro to make it happen:
1) Generate 10,000 random numbers from 1-38 down a column (already completed)
2) Start at the first number and identify if it is a win or loss. Repeat this process until a win occurs.
3) When a win occurs cut and paste all numbers below the winning number to the next column, starting back at the top row
For example:
Random Spins Win or loss -----> I would then want it to cut and paste the 8 and 9 to the next column
3 Loss Random Spins (1) Win or loss Random Spins (2) Win or loss
5 Loss 3 Loss 8 Loss
7 Win 5 Loss 9 Loss
8 7 Win

4) Then I want it to repeat the process with the numbers that were pasted to the next column (winning numbers would start back at the winning numbers for bet 1)
5) I then will have it organized in a way in which I will be able to count consecutive losses which I will write a separate macro for.

Any help would be greatly appreciated!!!!!!!!