Hi,
I need some VBA code to select a user determined amount of rows in a list. Say the list is 50 records. The code must prompt the user for an amount of random records to select. If the user says 10, then the code must select 10 random records in the 50 records.
Please help me to compile this code. TX
This is not working:
Sub RandomRows()
Dim Rng As Range
Dim NumRangeRows As Long
Dim NumRandRows As Long
NumRangeRows = Range(“A1”).CurrentRegion.Rows.Count
NumRandRows = InputBox(“Supply number of random rows to select”)
For i = 2 To NumRandRows
RandRow = Round(Rnd() * NumRangeRows, 0)
Set Rng = ActiveCell.Rows(RandRow)
Next i
Rng.Select
End Sub