VBA - Copy and Paste Table Data (without headers) from one workbook to another

JamesJones25

New Member
Joined
Aug 26, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need to copy and paste just the table data (not headers) from one workbook into a different existing workbook which I'm calling with that commented out "OpenBook" Module. Both existing tables are in the same format with same # of columns but the source book will have more rows than in the table range of the destination book - of which I'm trying to overwrite

This is what I've been trying but run into a "Subscript out of range" Error 9
1630537646776.png


Any help is much appreciated!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
When posting code, please copy/paste the actual code rather than a picture of it. That way, helpers can copy and test with it without having to manually re-type it (probably with errors). :)
My signature block below has help about that.

Subscript out of range would indicate that Excel cannot find an open workbook with one of those two workbook names or else it cannot find the correct sheet name in one of the workbooks.

In any case, assuming both workbooks are open with correct sheet names, your two lines of code need to be a single line.

VBA Code:
Workbooks("File.xlsm").Worksheets("Transformed Table").Range("A3:F9999").Copy Workbooks("NewFile.xlsx").Worksheets("NewTable").Range("A3:F9999")
 
Upvote 0
Solution

Forum statistics

Threads
1,216,153
Messages
6,129,172
Members
449,490
Latest member
TheSliink

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