You don't necessarily need to re-arrange the array. Instead, you could
simply read the elements of the array in arbitrary order, without
replacement. That is, get an array of N unique random numbers between
the lower bound upper bound of your array and then use these values to
access the elements in the array. Since you are reading the elements
in random order, the effect is the same as actually rearranging the
array order, but faster.
I have code at
http://www.cpearson.com/excel/randomNumbers.aspx to get
an array of non-repeating random long values. Using the
UniqueRandomLongs function described on that page, you can use code
like the following:
Dim S() As String
Dim N As Long
Dim Pos() As Long
ReDim S(1 To 5)
' load up some test values
S(1) = "a"
S(2) = "b"
S(3) = "c"
S(4) = "d"
S(5) = "e"
' get random indexes
Pos = UniqueRandomLongs(Minimum:=LBound(S), _
Maximum:=UBound(S), _
Number:=UBound(S) - LBound(S) + 1)
For N = LBound(Pos) To UBound(Pos)
Debug.Print S(Pos(N))
Next N
This will Debug.Print the elements of the array S random order provide
by the values of the Pos array of position indexes. If you really do
want them in a new array, use code like the following instead. T is
the new array with the elements of S in random order:
Dim S() As String
Dim T() As String
Dim N As Long
Dim Pos() As Long
ReDim S(1 To 5)
' load up some test values
S(1) = "a"
S(2) = "b"
S(3) = "c"
S(4) = "d"
S(5) = "e"
' get random indexes
Pos = UniqueRandomLongs(Minimum:=LBound(S), _
Maximum:=UBound(S), _
Number:=UBound(S) - LBound(S) + 1)
ReDim T(LBound(S) To UBound(S))
For N = LBound(Pos) To UBound(Pos)
T(N) = S(Pos(N))
Debug.Print T(N)
Next N
I also have a page with example for shuffling a single array. See
http://www.cpearson.com/excel/ShuffleArray.aspx .
Regarding your second question about installing Excel, I would
recommend that you keep your previous version of Excel. One of the
installation options is to keep existing versions. Use that option to
have both versions of Excel on the same machine. I have several
versions of Excel (XL2002, XL2003, XL2007, XL2010) on my main box and
have no problems. Note, though, that you cannot have more than one
version of Outlook on a machine. You can upgrade to Outlook 2007 or
you can continue to use Outlook 2003, but you cannot have both.
Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com