使用Excel VBA,如果我们创建 ArrayList ,其中一个项目是一维数组,我们如何修改其元素?下面我们有一个无法正常运行的代码。
Sub foobar()
Dim MyArrayList As New ArrayList
MyArrayList.Add "hello"
MyArrayList.Add Array("a", "b")
Debug.Print MyArrayList.Item(0) 'returns the word 'hello'
Debug.Print MyArrayList.Item(1)(0) 'returns the letter 'a'
MyArrayList.Item(0) = "bye"
MyArrayList.Item(1)(0) = "z"
Debug.Print MyArrayList.Item(0) 'returns the word 'bye'
Debug.Print MyArrayList.Item(1)(0) 'keep returning the letter 'a'
End Sub