Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to enter my own function in an array formula context,
similar to any other pre defined funtion. For example, let my array be {1;4;9;16;25;36} If I select a 6x1 range of cells and enter the formula =SQRT({1;4;9;16;25;36}) with a ctrl+shift+enter I get 1 2 3 4 5 6 Now I want to write a UDF that does the same thing Function myUDF(Input As Variant) As Variant myUDF = Input ^ 0.5 End Function when I enter =myUDF({1;4;9;16;25;36}) again, with ctrl+shift+enter I get #VALUE! #VALUE! #VALUE! #VALUE! #VALUE! #VALUE! Interestingly enough when I enter =myUDF(81) I get 9 Had myUDF been Function myUDF(Input As Variant) As Variant myUDF = Input End Function IE, no modification, just return what I get =myUDF({1;4;9;16;25;36}) returns 1 4 9 16 25 36 as expected. The problem seems to be when I try to use myUDF in an array context and I try to modify the input in any way. How can I get it to act just like the =SQRT({1;4;9;16;25;36}) And before anyone asks why I trying to emulate an already existing function, this is just an example to illustrate the problem. Please help and thanks in advance Sean |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Entering an array formula | Excel Worksheet Functions | |||
entering as an array | Excel Discussion (Misc queries) | |||
Entering Array Functions | Excel Discussion (Misc queries) | |||
Entering Array Formula | Excel Programming | |||
Programatically Entering an Array Formula | Excel Programming |