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 :)?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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
 
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top