编程技术、软件应用与系统模拟

(Programming, Applicaiton and Simulation)



本站目录

 

首页
ASP/Access/IIS
DELPHI/PASCAL
PASCAL高级编程
C语言编程实例
WORD
Excel
MATLAB
MINITAB讲座
Windows
DOS
SAS
生物系统模拟
土壤水分剖析器
其他



镜像站点

 

主站
北美镜象站
欧洲镜象站(1)
欧洲镜象站(2)

本站 Google

[搜索]  [站内导航]
座右铭:
只做有益人类的事
不做有害人类的事


Use array in a costomized worksheet function

Zhanshan Dong

We know there are a lot of worksheet functions that use an array as an argument. How can we use an array as an argument in our costomized worksheet functions? I'd like to address this question step by step.
1) The function declaration. In the function declaration part, you should declare an array parameter as an object. For example,
Function Test(Range1 as Object)
2) To access the elements in an input array. You can use traditional For-Next loop to access the elements in an array as we do for arrays declared in the function by DIM command.
3) To get the dimension size of an input array. Use UBOUND function to achieve the purpose. For example,
nSize = UBound(Range1(), 1)
This command will get the size of the first dimension of the input array. It is worthy to mention that the input array in the UBound function must be written like array name followed a pair of parentheses.
To see an example of using an input array, please refer to an article called "Enhanced Chi-Square Test Function in Excel".

© 1998-, 董占山, 版权所有。
转载文章请注明出处(www.sunfinedata.com/articles)。