是否可以在 EXCEL VBA 中将多维数组作为参数传递? [英] Is it possible to pass a multidimensional array as a parameter in EXCEL VBA?

查看:64
本文介绍了是否可以在 EXCEL VBA 中将多维数组作为参数传递?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个程序中创建了一个数组,它是最终结果,我想在新程序中利用这些结果作为那里计算的输入.有没有办法将多维数组作为参数传递给另一个过程?您将如何将其放入调用中以及如何在将要使用的过程中定义参数?

I have an array created in one procedure which is the final results, I want to utilise these results in a new procedure as inputs to the calculations there. Is there a way to pass a multidimensional array as a parameter into another procedure? How would you you put it into the call and how woudl you define the parameter in the procedure it will be used in?

谢谢

推荐答案

通过用括号装饰例程参数,像传递单维数组一样传递;

Pass as you would a single dimension array by decorating the routine argument with parentheses;

sub a()
    dim x(1, 1) As long
    x(0, 0) = 1
    x(1, 1) = 4
    process x
end sub

sub process(arr() As long)
    Msgbox arr(0, 0)
    Msgbox arr(1, 1)
end sub

这篇关于是否可以在 EXCEL VBA 中将多维数组作为参数传递?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆