lundi 23 novembre 2020

Select random cell in range

I'm trying to perform an action in VBA on a range of cells. I would like the selection of the cells to be random not in the order of how the range is setup.

Sub Solver_Step_Evo()
    Set Rng = GetRange(ThisWorkbook.ActiveSheet.Range("Variable_Range"))
    For Each i In Rng
       'perform an action on I where I is randomly selected.
    Next i
End Sub

My preference is it randomizes the order not just randomly select a cell where a cell can be picked more than once.

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire