2017-06-08 15 views
-3

數組的長度我有一個數組,看起來像這樣:如何確定在VBA

students1 = Array(423.5482, 425.6641) 

現在我想獲得這個數組的長度。但是,如果我嘗試這樣做:

MsgBox(students1.Length) 

我得到的錯誤,需要一個對象。任何雖然如何我可以得到的長度?

+1

你研究這個? –

+2

[Get length of array?]可能重複(https://stackoverflow.com/questions/30574814/get-length-of-array) – Aditya

+0

Dupe of https://stackoverflow.com/questions/30574814/get-length數組 – Aditya

回答

4

使用UBound函數和LBOUND和

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