Create a VBA sub program that creates a game for multiple players and finally declares the winner. The detailed procedures to create the game are given below:
• Create a spreadsheet and place the buttons as shown below in the picture.
• When the button “play” is clicked, the program should ask for the number of players and the number of cards.
• After getting the inputs, generate two random number, one for the card number and the other for the suit.
• Associate the first randomly generated numbers to the cards. For example, if you design a random number between 2 and 14, the numbers 2 through 10 represent the same value. The number 11 represents J, 12 – Q, 13 – K and 14 – A respectively.
• Associate the second set of randomly generated numbers to the suits. For example, if you design a random number between 1 and 4, the number 1 represents SPADES, 2 – DIAMONDS, 3 – HEARTS and 4 – CLUBS.
• Run a for loop to generate as many cards as you want and place them in the spreadsheet and run a for loop to calculate the points won by each player (For example, if a player has the card A-SPADE, then A translates to 14 points and SPADE translates to 1 point as coded in the random generator).
• Declare the player as “WINNER” as the player with the most points.
• Create a second sub program to clear the cells. Assign this sub program to the button “Clear”.
The following pictures show the results for 5 players and 9 cards.
❖ The points in the blue cells for each player are the sum of points earned by players from the number on the card and the type of card.