vba 优秀。从数组函数访问单个值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4178310/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 12:17:40  来源:igfitidea点击:

Excel. Access single value from array function

excelexcel-vbaexcel-2007vba

提问by Boppity Bop

I have a custom function in Excel 2007. It returns array of doubles.

我在 Excel 2007 中有一个自定义函数。它返回双精度数组。

Dim ResultArray(10) As Double

If I use it with Ctrl-Shift-Enter I get 10 results in a row.

如果我将它与 Ctrl-Shift-Enter 一起使用,我会连续得到 10 个结果。

I want to access a particular resut within the result array.

我想访问结果数组中的特定结果。

Say second result. I'd expect something like =myFn(a,b,c)(2) but it doesnt work....

说第二个结果。我希望像 =myFn(a,b,c)(2) 之类的东西,但它不起作用......

Is it possible?

是否可以?

回答by jon_darkstar

Use the Index function to get certain element of Array.

使用 Index 函数获取 Array 的某个元素。

=Index(myFn(a,b,c); 2)