Excel game - random selection from four lists by clicking on one of four buttons

FirstTimeVBA

New Member
Joined
Apr 23, 2020
Messages
1
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
Hi all,

I'm trying to build a little game in excel:
  • In sheet1:
    • Four lists from columnA to columnD. Each lists contains different actions
  • In sheet 2:
    • Four buttons which randomly select on of the items to the corresponding list in sheet 1
    • I would like to shown one text box that shows the most recent randomly selected items
    • Ideally a item that has already been randomly selected cannot be selected again when the button is clicked again (this is a 'nice to have')
So far I have been able to to create buttons
  • In sheet 2 I have four cells (A1 to D1) with an INDEX function and RANDBETWEEN function to randomly select one of the items in the corresponding list
  • I have created four buttons and assigned them to refresh the formula's in cell A1 to D1
    • For my game I would actually only like to refresh the cell related to the button that has been clicked, or show a text field that only displays the item related to the button (other cells/lists can be refreshed in background but then there should be no function that remembers which items have already been randomly selected, otherwise I would miss them when clicking the corresponding button in a next round.
The problem is that this will refresh everything in cell A1 to D1 independent of the button I click.

Probably I will have bo build a more advanced macro, but I don't know where to start.
Anybody that can help me out :)?
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Rijnsent

Well-known Member
Joined
Oct 17, 2005
Messages
1,298
Office Version
  1. 365
Platform
  1. Windows
Hi FirstTimeVBA,
welcome to the forum! Your description is quite extensive, but could you also share some code/sheet? There are 2 ways to do that: the preferred route is to use XL2BB for your sheet and the <VBA/> tag (in the menu bar when typing a message) for the VBA code. As an alternative, you could use e.g. dropbox/google drive to get a file across.
Thanks for some more info,
Koen
 

Watch MrExcel Video

Forum statistics

Threads
1,113,890
Messages
5,544,883
Members
410,643
Latest member
sng
Top