VBA: Copy Paste Multiple Ranges Into Another Workbook

losamfr17

Board Regular
Joined
Jun 10, 2016
Messages
149
Hello,

I want to copy the ranges from Workbook_A Sheet(1) into the exact same cells of Workbook_B Sheet(1).
Why won't this work and what is the best way to do that please?

Windows("Workbook_A").Sheets(1).Range("P4:R7,N22:N47, AC4:AE7,AA22:AA47, AP4:AR7,AN22:AN47, BC4:BE7,BA22:BA47, BP4:BR7,BN22:BN47").Copy

Thank you.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try:
Code:
WorkBooks("Workbook_A.xlsx").Sheets(1)
 
Upvote 0
This should work:
Code:
With Workbooks("Workbook_A.xlsx").Sheets(1)
    .Range("P4:R7, AC4:AE7, AP4:AR7, BC4:BE7, BP4:BR7").Copy
    .Range("N22:N47,AA22:AA47,AN22:AN47,BA22:BA47,BN22:BN47").Copy
End With
 
Upvote 0
I get an error message saying "that command cannot be used on multiple selections."
I am using Excel 2013. Is it working on your end?
 
Upvote 0
I tried it on some dummy data and it worked for me. Can you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Include a detailed explanation of what you would like to do using a few examples from your data and referring to specific cells, rows, columns and worksheets. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0
How about
Code:
Dim Rng As Range
For Each Rng In Workbooks("Workbook_A.xlsm").Sheets(1).Range("P4:R7,N22:N47, AC4:AE7,AA22:AA47, AP4:AR7,AN22:AN47, BC4:BE7,BA22:BA47, BP4:BR7,BN22:BN47")
   Rng.Copy Workbooks("Workbook_B.xlsm").Sheets(1).Range(Rng.Address)
Next Rng
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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