This question already has an answer here:
I have a list of 10 words on sheet2 and I need to create a button that puts 3 randomly selected words from this list onto another sheet. This needs to be repeated 10 times. i.e. I need to click the button and it comes up with something like; randomword randomword randomword randomword randomword randomword .....etc until this is done 10 times.
I have this so far but instead of the remaining 9 rows being randomized too, they are the same words as in the first row, can anyone help please?
For i = 1 To 10 'puts the list of 10 negative words into a list
myList(i) = Sheet2.Cells(i + 2, 1)
Next
Randomize
For i = 10 To 2 Step -1 'randomises the words in the list
r = Int((i - 1 + 1) * Rnd + 1)
temp = myList(i): myList(i) = myList(r): myList(r) = temp
Next i
For k = 1 To 10
For i = 1 To 3
Sheet3.Cells(k + 1, i + 1) = myList(i)
Next i
Next k
Aucun commentaire:
Enregistrer un commentaire