VinceF
Board Regular
- Joined
- Sep 22, 2007
- Messages
- 192
- Office Version
- 2016
- Platform
- Windows
Greetings,
I have a Form control button that runs this code, it generates a random# from 1 to 18 in cells A1, A2 & A3. How can I modify the code so that it doesn't duplicate a number?
Thank You,
VinceF
Excel 2016
Sub GenerateMultipleRandomIntegers()
Dim i As Integer
For i = 1 To 3
Range("A" & i) = WorksheetFunction.RandBetween(1, 18)
Next i
End Sub
I have a Form control button that runs this code, it generates a random# from 1 to 18 in cells A1, A2 & A3. How can I modify the code so that it doesn't duplicate a number?
Thank You,
VinceF
Excel 2016
Sub GenerateMultipleRandomIntegers()
Dim i As Integer
For i = 1 To 3
Range("A" & i) = WorksheetFunction.RandBetween(1, 18)
Next i
End Sub