MasterOfTheSky
asked on
Excel VBA Question (Please utilize For Loop & Do Loop)
There is a selection of five random digits that the “winning number.” The user should be able to buy as many tickets (each containing five random numbers) as they would like at $1 per ticket. If one of the user ticket matches the winning number, the user wins $100,000. Assuming that order matters, if the winning number is 21345, then 12345 doesn’t win.)
I am trying to write a sub that will first, generates a random winning number, then stores it in a string variable so that you can use string concatenation, next it will asks the how many cards user wants to buy. It must then use a For Loop to generate this many cards and store their number in a card array which should be a string array. Next, it should use a DO LOOP to keep checking cards until a winner has been found or no more cards remain. Lastly, it must display a message saying whether you are a winner and what your net gain or loss. A single random digit from 0 to 9 can be generate with excel’s RandBetween Function.
I am trying to write a sub that will first, generates a random winning number, then stores it in a string variable so that you can use string concatenation, next it will asks the how many cards user wants to buy. It must then use a For Loop to generate this many cards and store their number in a card array which should be a string array. Next, it should use a DO LOOP to keep checking cards until a winner has been found or no more cards remain. Lastly, it must display a message saying whether you are a winner and what your net gain or loss. A single random digit from 0 to 9 can be generate with excel’s RandBetween Function.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Matthewspatrick my co workers and I are conducting an experiment on lottery tickets. Thank you!!
ASKER
Thank You very much!! It works!!!
With respect, this question appears to be an academic assignment. Putting that aside for the moment...
Patrick