Thank You,
I tried something like the following:
Sub test_sums()
Dim inputgen(10), out(10) As Variant
For i = 1 To 10
inputgen(i) = i
Next i
For i = 1 To 10
out(i) = outputgen(inputgen())
Next i
End Sub
Function outputgen(ParamArray inputgen() As Variant)
sumtest = 0
For i = 1 To UBound(inputgen())
sumtest = sumtest + inputgen()
Next i
End Function
It accepts the paramarray argument, but has a type error on the sumtest + argument. Also, ideally I would like output gen to call some range of inputgen elements, like
out(i) = outputgen(inputgen(2:11))
Where the function would then process those elements from inputgen 2 through 11 in a loop of each element, one at a time.
is there a way to do this specific example? thanks again.
-----------------------------------------------------------------------
-----------------------------------------------------------------------
An example of something closer that works is as follows:
Sub test_sums()
Dim inputgen(10), out(10) As Variant
For i = 0 To 9
inputgen(i) = i + 5
Next i
For i = 1 To 10
out(i) = outputgen(inputgen(1), inputgen(2), inputgen(3))
Next i
End Sub
Function outputgen(ParamArray inputgen() As Variant)
Dim sumtest As Double
sumtest = 0
For i = 0 To UBound(inputgen())
sumtest = inputgen(i) + sumtest
Next i
outputgen = sumtest
End Function
Only, I had to explicitly call each element in my function:
i.e. out(i) = outputgen(inputgen(1), inputgen(2), inputgen(3))
I would like to simply say out(i) = outputgen(inputgen())
or out(i) = outputgen(inputgen(1:3))
instead of listing each element explicitly.
Ideally I could just call a function like outputgen(nfirst, nlast, inputgen())
and then have n be the number of elements of inputgen to process.
Any other ideas?
Bookmarks