ARRAY loop BLANK!!!!

User avatar
sal21
PlatinumLounger
Posts: 4380
Joined: 26 Apr 2010, 17:36

ARRAY loop BLANK!!!!

Post by sal21 »

I fill the array during a loop in txt file:

....

Code: Select all

If Mid(MyArray(X), 1, 8) = "ASSEGNO:" And TEST = True Then
                    
                    Z = Z + 1
                    ReDim Preserve ARRAY_ASS(1 To 3, 1 To Z)
                    
                    ASSEGNO = Mid(MyArray(X), 12, 10)
                    NT = Mid(MyArray(X), 43, 2)
                    IMPORTO = Trim(Mid(MyArray(X), 88, 24))
                    
                    ARRAY_ASS(1, Z) = ASSEGNO
                    ARRAY_ASS(2, Z) = IMPORTO
                    ARRAY_ASS(3, Z) = NT
                    
                End If
and loop with:

Code: Select all

Dim M As Long, N As Long
                    For N = LBound(ARRAY_ASS, 2) To UBound(ARRAY_ASS, 2)
                    For M = LBound(ARRAY_ASS, 1) To UBound(ARRAY_ASS, 1)
                        Debug.Print ARRAY_ASS(M, N)
                    Next M
                    Next N                    
the debug.prinnt is blank in all element of loop?????

User avatar
HansV
Administrator
Posts: 78674
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: ARRAY loop BLANK!!!!

Post by HansV »

Is the second loop within the same procedure as the first one?
What happens if you insert a line

Debug.Print ASSEGNO, IMPORTO, NT

above the line End If in the first loop?
Best wishes,
Hans