Simon2001
New Member
- Joined
- Jun 28, 2019
- Messages
- 16
- Office Version
- 365
- Platform
- Windows
Hello
This old post is quite frankly brilliant and exactly what I needed to create. I have been using a random generator but couldn't figure out how to avoid duplicates.
I've got it working perfect and I'm now trying to figure out how to make the range dynamic so rather than a fixed 90 rows/numbers, I want to be able to enter a value in a cell for maximum number of entries so 16, 32, whatever, etc)
Sub StartOver()
ActiveSheet.UsedRange.Clear
Range("E1") = "Number"
Range("F1") = "Sort"
Range("E2") = 1
Range("E2:E17").DataSeries Step:=1
Range("F2:F17").Formula = "=Rand()"
End Sub
Sub DrawUnique()
Range("F1").CurrentRegion.Sort Key1:=Range("F1"), Header:=xlYes
Range("E100").End(xlUp).Copy Destination:=Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Range("E100").End(xlUp).Resize(1, 2).Clear
End Sub
Can anyone suggest a way to alter this code to do this?
Thanks
This old post is quite frankly brilliant and exactly what I needed to create. I have been using a random generator but couldn't figure out how to avoid duplicates.
Bingo Draw No duplicates
Hi All, I found a video on youtube that draws bingo numbers with no repeats so I simply copied the Macro code by hand, the first part works and creates a random set of numbers the second part however is coming back with an error. This part works fine: Sub StartOver() Cells.Clear...
www.mrexcel.com
I've got it working perfect and I'm now trying to figure out how to make the range dynamic so rather than a fixed 90 rows/numbers, I want to be able to enter a value in a cell for maximum number of entries so 16, 32, whatever, etc)
Sub StartOver()
ActiveSheet.UsedRange.Clear
Range("E1") = "Number"
Range("F1") = "Sort"
Range("E2") = 1
Range("E2:E17").DataSeries Step:=1
Range("F2:F17").Formula = "=Rand()"
End Sub
Sub DrawUnique()
Range("F1").CurrentRegion.Sort Key1:=Range("F1"), Header:=xlYes
Range("E100").End(xlUp).Copy Destination:=Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Range("E100").End(xlUp).Resize(1, 2).Clear
End Sub
Can anyone suggest a way to alter this code to do this?
Thanks