我已将数组声明为
Dim weights As Variant
以下程序可以打印:
Dim item As Variant
For Each item In weights
Debug.Print item
Next item
但是以下程序没有打印任何内容:
Dim i As Integer
For i = LBound(weights) To UBound(weights)
Debug.Print CStr(weights(i - 1))
Next i
请帮忙。
我刚刚注意到以下作品:
Dim i As Integer
For i = LBound(weights) To UBound(weights)
Debug.Print weights(i, 1)
Next i
有人可以解释一下为什么吗?
您应该将数组声明为
Dim weights() As Variant