VBA 在多维数组上使用 ubound [英] VBA using ubound on a multidimensional array

查看:39
本文介绍了VBA 在多维数组上使用 ubound的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ubound 可以返回数组的最大索引值,但是在多维数组中,如何指定我想要的最大索引的维度?

Ubound can return the max index value of an array, but in a multidimensional array, how would I specify WHICH dimension I want the max index of?

例如

Dim arr(1 to 4, 1 to 3) As Variant

在这个 4x3 数组中,如何让 Ubound 返回 4,如何让 Ubound 返回 3?

In this 4x3 array, how would I have Ubound return 4, and how would I have Ubound return 3?

推荐答案

ubound(arr, 1) 

ubound(arr, 2) 

这篇关于VBA 在多维数组上使用 ubound的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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