下标超出范围,VBA

时间:2014-01-23 11:31:50

标签: vba

嗨我收到错误,因为下标超出范围,但我无法确定原因。我是VBA的新手,请帮帮我。谢谢。

1 个答案:

答案 0 :(得分:1)

t = 0更改为t = 1,因为arr数组的维度始于1ReDim arr(1 To UBound(aryValues))):

t = 1 

For i = LBound(aryValues) + 1 To UBound(aryValues)
    For Each v In dict.Keys
        If v = aryMembers(i) And c = 0 Then
            arr(t) = aryValues(i)
            c = c + 1
            t = t + 1
        End If
    Next
    c = 0
Next