Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在VBA中确定数组的长度_Vba - Fatal编程技术网

如何在VBA中确定数组的长度

如何在VBA中确定数组的长度,vba,Vba,我有一个如下所示的数组: students1 = Array(423.5482, 425.6641) 现在我想得到这个数组的长度。但是,如果我尝试这样做: MsgBox(students1.Length) 我得到的错误是需要一个对象。关于如何计算长度有什么想法吗?使用UBound和Lbound MsgBox Ubound(students1)-Lbound(students1)+1 使用UBound和Lbound MsgBox Ubound(students1)-Lbound(stud

我有一个如下所示的数组:

 students1 = Array(423.5482, 425.6641)
现在我想得到这个数组的长度。但是,如果我尝试这样做:

 MsgBox(students1.Length)

我得到的错误是需要一个对象。关于如何计算长度有什么想法吗?

使用UBound和Lbound

MsgBox Ubound(students1)-Lbound(students1)+1

使用UBound和Lbound

MsgBox Ubound(students1)-Lbound(students1)+1

你研究过这个吗?可能重复的google获取数组长度vba的重复的第二个链接你研究过这个吗?可能重复的google获取数组长度vba的重复的第二个链接这对动态数组不起作用,因为UBound会出错。这个问题不是关于动态数组,而是关于集合数组。这不起作用在动态数组上,因为UBound会出错。这个问题不是关于动态数组,而是关于集合数组。