Hey All,
So, I have a list of items in a column, that I'd like to randomly pick from.
I have a very basic routine, that picks on, and highlights the column a based on what it picks. But,
I'd like to be able to randomly pick, but if it's already been picked before to not pick it again, I'm guessing by checking the colour of the cell?
At the moment, I have this
Sub FindRandomCell()
Dim ColumnA As Long
Dim StartRow As Long
Dim HeaderRow As Long
Dim LastRow As Long
Dim randomNum As Long
ColumnA = 1
HeaderRow = 1
StartRow = 3
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
randomNum = WorksheetFunction.RandBetween(StartRow, LastRow)
Cells(randomNum, ColumnA).Interior.Color = RGB(0, 255, 0)
Cells(randomNum, ColumnA).Select
End Sub
Any thoughts would be appreciated.
Thanks.
So, I have a list of items in a column, that I'd like to randomly pick from.
I have a very basic routine, that picks on, and highlights the column a based on what it picks. But,
I'd like to be able to randomly pick, but if it's already been picked before to not pick it again, I'm guessing by checking the colour of the cell?
At the moment, I have this
Sub FindRandomCell()
Dim ColumnA As Long
Dim StartRow As Long
Dim HeaderRow As Long
Dim LastRow As Long
Dim randomNum As Long
ColumnA = 1
HeaderRow = 1
StartRow = 3
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
randomNum = WorksheetFunction.RandBetween(StartRow, LastRow)
Cells(randomNum, ColumnA).Interior.Color = RGB(0, 255, 0)
Cells(randomNum, ColumnA).Select
End Sub
Any thoughts would be appreciated.
Thanks.
Last edited: