遍历VBA索引阵列,并在特定的指数获得元素

遍历VBA索引阵列,并在特定的指数获得元素

问题描述:

我现在想这样的事情遍历VBA索引阵列,并在特定的指数获得元素

Dim myAddress() As String 
myAddress= Split("4th Street NW Washington, DC") 

For intI = 1 To UBound(myAddress) 
    `how can i access myAddress[intI+1] from here? 
Next intI 

试试这个:

Dim myAddress() As String 
myAddress= Split("4th Street NW Washington, DC") 

For intI = 1 To UBound(myAddress) 
    Console.WriteLine(myAddress(intI)) 
Next intI 
+0

感谢,它是循环如何内工作的问题我会访问+1或下一个元素 – user391986

+2

使用myAddress(intI) – duDE

+2

VBA默认为0作为第一个数组元素的索引。 – HansUp