Why do I get this error;
Type mismatch: 'UBound'
Function JumbleArray(ByVal aArray)
Dim iUpper, iLower, iLoop, iSwapPos, varTmp
iUpper = UBound(aArray)
iLower = LBound(aArray)
Randomize Timer
For iLoop = iLower To iUpper
iSwapPos = Int(Rnd * (iUpper + 1))
varTmp = aArray(iLoop)
aArray(iLoop) = aArray(iSwapPos)
aArray(iSwapPos) = varTmp
Next
JumbleArray = aArray
End Function
Dim strTestArray
strTestArray = "1,2,3,4,5,6,7,8"
Shuffle = JumbleArray(strTestArray)
This code was proposed elsewhere but without any reports of it not working. It looks like it should work, but it does not.
The code shown here is everything that you need. By simply running the code you will see the error.