I was given this piece of code that will go and select a random sampling of 25 rows in my spreadsheet. I need an addition to it however and have not been able to find a way to do it. My data is on Columns B through AE, what I need is a "Y" inputted into column A if the row is randomly selected. Here is the code that I have so far:
Code
Sub RandomRows()
Dim d As Object, r As Range, vKeys, x&
'get a set of 25 unique numbers
Set d = CreateObject("Scripting.Dictionary")
While d.Count < 26
'Define the min,max of your numbers
Y = "Y"
x = RndBetween(10, 510)
If Not d.Exists(x) Then d.Add x, Empty
Wend
'Create a multiarea range
vKeys = d.keys
Set r = Rows(vKeys(0))
For x = 1 To UBound(vKeys)
Set r = Union(r, Rows(vKeys(x)))
Next
'Select it
End Sub
Function RndBetween(low&, high&) As Long
RndBetween = CLng(Rnd * (high - low)) + low
End Function
Display More