Sorry if this seems simple, but I have searched for what I'm looking for and not finding the exact results. What I'm looking to do is create a daily roster for employees in my department. I want to take and create a list of names that will be working on that day, and hit a button which will randomly take those names and fill in the employee work positions that are listed on the left, without duplicates. So far I have created the positions to be filled, created a list of names, and used rand() and index to randomly put the names into those fields. What I would like to do is create a macro button that will allow the names to be randomized when I click the button instead of every time the spreadsheet has a new entry. I have created a Macro button, but I cannot figure out the coding inside the button to do what I would like to happen.
What I have previously tried was using the following formulas to create what I want...with no success.
Range("k5") = WorksheetFunction.RandBetween(0, 13)
but that only gave a random number to cell k5, so I tried this instead:
Range("$k$5:$k$17") = WorksheetFunction.RandBetween(0, 13)
but that gave the same number for all cells instead of different numbers. Is there a way to use RAND with the macro button?
any help would greatly be appreciated. I feel like I'm close to my goal but have hit a road block.
Aucun commentaire:
Enregistrer un commentaire