Excel VBA 等效于向量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13141398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Excel VBA equivalent of a vector
提问by czchlong
Does Excel VBA have a data structure equivalent of the vector?
Excel VBA 是否具有与向量等效的数据结构?
I am still learning Excel VBA and do not like the ReDim Preserve
semantics. But if that is the only way, then so be it.
我还在学习 Excel VBA,不喜欢ReDim Preserve
语义。但如果这是唯一的方法,那就这样吧。
So does Excel VBA 2003 provide a dynamic list type data structure?
那么 Excel VBA 2003 是否提供了动态列表类型的数据结构?
采纳答案by KekuSemau
A simple sequential list
-datatype would be Collection
. Besides, an associative array is available via CreateObject("Scripting.Dictionary")
.
一个简单的顺序数据list
类型是Collection
. 此外,关联数组可通过CreateObject("Scripting.Dictionary")
.
Dim c As Collection
Set c = New Collection
c.Add 4