Overwrite table fields with 2D array contents

I have a 2D array populated with 3 sets of data. MyArray(x,x,x)
I have a table with 5 columns in it, I need Columns 1,2 and 3 to be populated by my array.  I'm trying application.transpose to a range
by getting type mismatch. I've never transposed anything other than a 1D Array so not sure I'm doing it right.

Here's the code:

'... find data and count number of rows...
Dim i as integer, x as integer, y as integer
Dim MyArray as variant

ReDim MyArray(iRow, iRow, iRow)


Do
ws.Range("A" & x).Select
MyArray(y, 0, 0) = ActiveCell.Value
ws.Range("C" & x).Select
MyArray(0, y, 0) = ActiveCell.Value
ws.Range("M" & x).Select
MyArray(0, 0, y) = ActiveCell.Value
y = y + 1
x = x + 1
Loop Until x > iRow


ThisWorkbook.Activate
Sheets("Report").Select
Set tbl = Sheets("Report").Range("HoursReport").ListObject

' paste 2D array into table
Range("D9:F" & UBound(MyArray) + 1).Value = Application.Transpose(MyArray)

Open in new window

LVL 2
Conor_NewmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

'... find data and count number of rows...
Dim i as integer, x as integer, y as integer
Dim MyArray as variant

ReDim MyArray(2, iRow - 1)


Do
ws.Range("A" & x).Select
MyArray(0, x - 1) = ActiveCell.Value
Ws.Range("C" & x).Select
MyArray(1, x - 1) = ActiveCell.Value
Ws.Range("M" & x).Select
MyArray(2, x - 1) = ActiveCell.Value

x = x + 1
Loop Until x > iRow


ThisWorkbook.Activate
Sheets("Report").Select
Set tbl = Sheets("Report").Range("HoursReport").ListObject

' paste 2D array into table
Range("D9:F" & UBound(MyArray, 2) + 9).Value = Application.Transpose(MyArray)

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Conor_NewmanAuthor Commented:
brilliant! thank you sir!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.