Hi All, this is driving me crazy. I have looked all over and tried a ton of things. Hitting a wall.
I am just trying to load in data from an Excel Table to an array. Later on I want to add a new row to this 2d array that was created.
Code:
Dim Arr As Variant
Arr = Worksheets(wsVal).ListObjects(tblVal).DataBodyRange
This works fine and loads in the values of a table that is 1 row by 7 columns
Now I want to simply add a new Row to this array while preserving the old values.
So I try this statement:
ReDim Preserve Arr(1 To 2, 1 To 7) As Variant
This statement gives me a "Subscript out of range" error
This statement works fine:
ReDim Preserve Arr(1 To 1, 1 To 7) As Variant
And it preserves row #1 Array values Arr(1,1) Arr(1,2), etc. But of course it is not doing what I want it to do (which is to add a new row to the Array)
What do I need to do to accomplish this?
Thanks.
I am just trying to load in data from an Excel Table to an array. Later on I want to add a new row to this 2d array that was created.
Code:
Dim Arr As Variant
Arr = Worksheets(wsVal).ListObjects(tblVal).DataBodyRange
This works fine and loads in the values of a table that is 1 row by 7 columns
Now I want to simply add a new Row to this array while preserving the old values.
So I try this statement:
ReDim Preserve Arr(1 To 2, 1 To 7) As Variant
This statement gives me a "Subscript out of range" error
This statement works fine:
ReDim Preserve Arr(1 To 1, 1 To 7) As Variant
And it preserves row #1 Array values Arr(1,1) Arr(1,2), etc. But of course it is not doing what I want it to do (which is to add a new row to the Array)
What do I need to do to accomplish this?
Thanks.