Microsoft Office Tutorials and References
In Depth Information
The RANDOMINTEGERS function returns an array of nonduplicated integers. This function is intended for
use in a multicell array formula. Figure 26-8 shows a worksheet that uses the following formula in the range
A3:D12:
{=RANDOMINTEGERS()}
Figure 26-8: An array formula generates nonduplicated consecutive integers, arranged randomly.
This formula was entered into the entire range by using Ctrl+Shift+Enter. The formula returns an array of non-
duplicated integers, arranged randomly. Because 40 cells contain the formula, the integers range from 1 to 40.
The following is the code for RANDOMINTEGERS:
Function RANDOMINTEGERS()
Dim FuncRange As Range
Dim V() As Integer, ValArray() As Integer
Dim CellCount As Double
Dim i As Integer, j As Integer
Dim r As Integer, c As Integer
Dim Temp1 As Variant, Temp2 As Variant
Dim RCount As Integer, CCount As Integer
Randomize
Create Range object
Search JabSto ::




Custom Search