AccessIsEggs
New member
- Local time
- Today, 02:29
- Joined
- Jul 24, 2019
- Messages
- 9
Hi all,
I was curious if someone could tell me why my arr2 is out of range, I can't seem to figure out what is going on with it.
Dim arr2() As String
ReDim arr2(0)
Dim j As Integer
For i = LBound(arr) To UBound(arr)
If arr(i) = arr(i + j) Then
For j = 0 To 200
k = (i + j)
If arr(i) = arr(k) Then
arr2(z) = Worksheets("BOM ").Cells(k, 2).Value
ReDim Preserve arr2(z)
z = z + 1
Else
Exit For
End If
Next
Else
'code will be here
End If
Next
I've checked to see if it was the
worksheets("BOM ").cells(k, 2).value
that was causing my error, and it is not.
arr2(z) goes to <subscript out of range>
Thank you very much for any input.
I was curious if someone could tell me why my arr2 is out of range, I can't seem to figure out what is going on with it.
Dim arr2() As String
ReDim arr2(0)
Dim j As Integer
For i = LBound(arr) To UBound(arr)
If arr(i) = arr(i + j) Then
For j = 0 To 200
k = (i + j)
If arr(i) = arr(k) Then
arr2(z) = Worksheets("BOM ").Cells(k, 2).Value
ReDim Preserve arr2(z)
z = z + 1
Else
Exit For
End If
Next
Else
'code will be here
End If
Next
I've checked to see if it was the
worksheets("BOM ").cells(k, 2).value
that was causing my error, and it is not.
arr2(z) goes to <subscript out of range>
Thank you very much for any input.