Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
HERE IS A CODE SNIPPIT
Sub randomgen() Dim randomWeights() As Integer Dim extraWeights() As Integer Dim temp() As Integer Dim lastNumber() As Integer Dim firstNumber() As Integer Dim extras(), randoms() ReDim unsortedRandoms(Cells(2, 2) * 5) ReDim unsortedExtras(Cells(3, 2) * 5) ReDim firstNumber(Cells(4, 2)) ReDim lastNumber(Cells(4, 2)) ReDim randomWeights(Cells(4, 2)) ReDim extraWeights(Cells(4, 2)) randomWeights(q) = Round((lastNumber(q) - firstNumber(q)) * Cells(2, 2) * 5 / totalRange) extraWeights(q) = Round((lastNumber(q) - firstNumber(q)) * Cells(3, 2) * 5 / totalRange) temp = RandomNumbers(lastNumber(q), firstNumber(q), (randomWeights(q) + extraWeights(q))) end sub Public Function RandomNumbers(Upper As Integer, _ Optional Lower As Integer = 1, _ Optional HowMany As Integer = 1, _ Optional Unique As Boolean = True) As Variant end function END OF CODE SNIPPIT I want to call the RandomNumber function using the values in those arrays at index q. What am I doing wrong? I get a runtime error 13 type mismatch on the RandomNumbers function call. Thanks in advance, Phil |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I use and indexed value as the name of an array for vlooku | Excel Worksheet Functions | |||
Passing array from Access to Excel function | Excel Programming | |||
Sum from an indexed array/table | Excel Discussion (Misc queries) | |||
Passing array of strings from DLL function to VBA | Excel Programming | |||
Passing array to a function | Excel Programming |