Loaded a table into an array - how do I get it back out?

TheRedCardinal

Board Regular
Joined
Jul 11, 2019
Messages
243
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all,

I've loaded the data from a table into an array:

VBA Code:
TableArray = WS1.ListObjects(1).DataBodyRange

I then manipulate the data inside the array using various loops.

Now I want to put it back in the table. The size can never change.

I tried this:

VBA Code:
WS1.ListObjects(1).DataBodyRange = TableArray

But obviously from the thread, this hasn't worked!

Is there a simple way to drop the result of the array back into the table?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
That is actually the right way:confused:
 
Upvote 0
Solution
How about
VBA Code:
   Ws1.ListObjects(1).DataBodyRange.Cells(1).Resize(UBound(TableArray), UBound(TableArray, 1)).Value = TableArray
 
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,386
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top