I need 13 random numbers from cell A1 to A13 if i press the button all cells should select random numbers but each cell should not have duplicate number from A1 TO A13.
Here's one way...Hi,
I need 13 random numbers from cell A1 to A13 if i press the button all cells should select random numbers but each cell should not have duplicate number from A1 TO A13. please help.
thanks alot.
regards
=MRAND(13,1,13)
I'm not much of a programmer so I can't help you with a command button.thanks, it work great is it possible to use command button as soon as i press button all 13teen cells get refreshed with new random numbers. actually its a chess game ...... thank once again for your help. kind regards.
Sub ShuffleTheNums()
Calculate
End Sub
In my opinion Buttons on a worksheet are nothing but trouble, especially when sheets are copied time and time again.If you absolutely have to have a button .....
=MRAND(13,1,13)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address(0, 0)
Case "A1"
Range("B2:B14").Calculate
Target.Offset(0, 1).Select
Case "C1"
Range("D2:D14").FormulaArray = "=MRAND(13,1,13,1)"
Target.Offset(0, 1).Select
End Select
End Sub
Excel Workbook | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Randomise B | Volatile | Randomise D | Static | ||
2 | 13 | |||||
3 | 2 | |||||
4 | 12 | |||||
5 | 11 | |||||
6 | 8 | |||||
7 | 4 | |||||
8 | 1 | |||||
9 | 5 | |||||
10 | 10 | |||||
11 | 9 | |||||
12 | 3 | |||||
13 | 6 | |||||
14 | 7 | |||||
Sheet1 |