Microsoft Office Tutorials and References
In Depth Information
ValArray(2, j) = ValArray(2, i)
ValArray(1, i) = Temp1
ValArray(2, i) = Temp2
End If
Next j
Next i
‘ Put the randomized values into the V array
i = 0
For r = 1 To RCount
For c = 1 To CCount
i = i + 1
V(r, c) = ValArray(2, i)
Next c
Next r
RANGERANDOMIZE = V
End Function
The code closely resembles the code for the RANDOMINTEGERS function. Figure 26-9 shows the function in
use. The following array formula, which is in A17:D29, returns the contents of A2:D14 in a random order:
{=RANGERANDOMIZE(A2:D14)}
The workbook range randomize function.xlsm, which contains the RANGERANDOMIZE
function, is available at this topic's website.
Using optional arguments
Many of the built-in Excel worksheet functions use optional arguments. For example, the LEFT function returns
characters from the left side of a string. Its official syntax is as follows:
LEFT(text,num_chars)
The first argument is required, but the second is optional. If you omit the optional argument, Excel assumes a
value of 1.
Search JabSto ::




Custom Search