Excel VBA - How to Redim a 2D array?

前端 未结 9 2195
闹比i
闹比i 2020-11-30 06:57

In Excel via Visual Basic, I am iterating through a CSV file of invoices that is loaded into Excel. The invoices are in a determinable pattern by client.

I am readin

9条回答
  •  甜味超标
    2020-11-30 07:24

    Here is how I do this.

    Dim TAV() As Variant
    Dim ArrayToPreserve() as Variant
    
    TAV = ArrayToPreserve
    ReDim ArrayToPreserve(nDim1, nDim2)
    For i = 0 To UBound(TAV, 1)
        For j = 0 To UBound(TAV, 2)
            ArrayToPreserve(i, j) = TAV(i, j)
        Next j
    Next i
    

提交回复
热议问题