My Data is
Person City New City
A P
B Q
C R
I want to randomly assign the New City to a person from the list of City (Column 2). However, New City should not be same as the one which is already assigned to the person.
I tried creating an Excel macro, however, I'm unable to get the Reference Library for the same. e.g.
Dim RandomClass As New Random()
Dim RememberSet As New HashSet(Of Integer)
Dim RandomNumber As Integer
While RememberSet.Count < 5
RandomNumber = RandomClass.Next(0, 10)
If RememberSet.Add(RandomNumber) Then
MsgBox (RandomNumber)
End If
End While
gives a compile time error at first two lines. Can anyone please help? Or upload an excel macro which is using list or collections?