Posted to microsoft.public.excel.programming
|
|
Redesign for hitting limit argument in a UDF
Your wasing you time with paramarrays. If you want to check values, you can
add code to do that, but this is the basic approach you need.
Public function Newton(rng as Range,rng1 as Range)
if rng.count < 29 or rng1.count < 1 then
Newton = cvErr(xlErrRef)
exit function
End if
P = rng(1)
n = rng(2)
F = rng(3)
A1 = rng(4)
m1 = rng(5)
A2 = rng(6)
m2 = rng(7)
A3 = rng(8)
m3 = rng(9)
A4 = rng(10)
m4 = rng(11)
A5 = rng(12)
m5 = rng(13)
A6 = rng(14)
m6 = rng(15)
A7 = rng(16)
m7 = rng(17)
A8 = rng(18)
m8 = rng(19)
A9 = rng(20)
m9 = rng(21)
A10 = rng(22)
m10 = rng(23)
A11 = rng(24)
m11 = rng(25)
A12 = rng(26)
m12 = rng(27)
A13 = rng(28)
m13 = rng(29)
iannual = rng1
' existing code
End function
--
Regards,
Tom Ogilvy
"Peter M" wrote in message
...
I currently have the following, which of course breaks down once you hit
the
limit of 29 arguments in a user defined function:
In the Worksheet:
=Newton(B11,B12,B13,B14,B15,B16,B17,B18,B19,B20,B2 1,B22,B23,
B24,B25,B26,B27,B28,B29,B30,B31,B32,B33,B34,B35,B3 6,B37,B38,
B39,B38)
In VB:
Function Newton(P, n, F, A1, m1, A2, m2, A3, m3, A4,m4, A5,m5,A6, m6,
A7, m7, A8, m8, A9, m9, A10,m10, A11, m11, A12, m12, A13, m13, iannual)
To redesign, I have:
In the Worksheet:
=Newton(B11:B39,B8)
In VB:
Function Newton(.......?)
??
Any help here to make this work is appreciated. I can't seem to ge this
to
work.
--
Thanks for any help
|