How do I return a range of cells as an output of an Excel Builder object in VBA function?
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to fill an Excel cell array with the output of a function defined in my Excel Builder Component. I know how to place the output of the function in a single cell. However, I do not know how to fill an array of cells.
For example:
If I have the function in VBA:
Function foo(x1 As Variant) As Variant
Dim aClass As Object
Dim y As Variant 'output
aClass = CreateObject("mycomponent.myclass.1_0")
Call aClass.foo(1,y,x1)
foo = y
End Function
In Excel, I would like to pass the following range of cells into this function:
A1:1
A2:2
A3:3
and have it output to the range:
B1:B3
This is simple to implement if I used a VBA subfunction.
採用された回答
MathWorks Support Team
2012 年 9 月 10 日
You can return an array of cells from a MATLAB Excel Builder component by entering the formula as an array formula. This is accomplished by pressing CTRL+SHIFT+ENTER.
Select cells B1-B3, and enter the formula,
=foo(A1:A3)
Again to evaluate as an array formula, press CTRL+SHIFT+ENTER.
Consult the Excel documentation for more information on array formulas.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Export to MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!