count numbers selected by randomize

Working on a keno game. have added a Autoplay with an option to stop Auto play after user defined # of times with a max of 2000.if user selects 2000 the the game will randomize  80 numbers with 20 selections for each randomize and update the results with each run. Some one asked me to add a feature to display the most popular number of the 80 being hit.

What could i use to keep track of how many times each number is selected and display the results. Preferably sorted by the highest hit number at the top?
number 1, hit 25 times
number 2, hit 35 times
number 3, hit 55 times
all the way to number 80
Who is Participating?
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
You could keep a simple array and increment the number by incrementing the index value:

    Dim ValueCount(1 to 80) As Long

So if number 40 was picked, you increment index 40:

    ValueCount(40) = ValueCount(40) + 1

Here's some example code for sorting small arrays:
isnoend2001Author Commented:
thank you pretty simple
isnoend2001Author Commented:
could you show me how to write this:
Dim mNumberCount(1 To 80) As Long 'form declaration
mNumberCount(i) = DrawnNumber (i)
        mNumberCount(i) = mNumberCount(i) + 1

DrawnNumber (i) is the number selected
Mike TomlinsonMiddle School Assistant TeacherCommented:
It would be something more like

    Dim number As Long
    Dim mNumberCount(1 To 80) As Long 'form declaration

    number = DrawnNumber (i)
    mNumberCount(number) = mNumberCount(number) + 1
isnoend2001Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.