I have a do loop which I want to keep looping until all 9 or so values are unique.
Do
m1 = createManager
m2 = createManager
m3 = createManager
m4 = createManager
m5 = createManager
m6 = createManager
m7 = createManager
m8 = createManager
m9 = createManager
Loop Until m1 <> m2 <> m3 <> m4 <> m5 <> m6 <> m7 <> m8 <>m9
These 9 values are created by a function which gets a random indexed value from an array.
Function createManager() As Variant
'Creates a random manager between the ages of 30 & 60
Do
Randomize Timer()
pos = Int((UBound(arr2)) * Rnd + 1)
age = arr2(pos)
Loop Until age > 30 And age < 65
'Assigns the appropiate mangerID to the manager
managerID = arr(pos)
createManager = managerID
End Function
What I am having issue with is the loop until part. m1 <> m2 <> m3 <> m4 <> m5 <> m6 <> m7 <> m8 <>m9 is what i have as a placeholder but is there an easy way to write this without a long IF AND statement?
UPDATE: Currently exploring collections and seeing whether this will provide by with what I am after...