I'd like to have more than one dynamic range copied on top of each other

blodesbaum

New Member
Joined
Mar 16, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hey! So as the title explains, I have some sheets with different dynamic ranges, which I'd like to copy into one sheet. Here's the code I have so far:

VBA Code:
Workbooks("220312_Workplan_PP_AP.xlsm").Worksheets("Workplan").Range("C6:D2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("A5")
  
Workbooks("220312_Workplan_PP_CM.xlsm").Worksheets("Workplan").Range("C6:D2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("A5")

Workbooks("220312_Workplan_PP_LA.xlsm").Worksheets("Workplan").Range("C6:D2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("A5")

Workbooks("220312_Workplan_PP_AP.xlsm").Worksheets("Workplan").Range("E6:F2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("C5")
  
Workbooks("220312_Workplan_PP_CM.xlsm").Worksheets("Workplan").Range("E6:F2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("C5")
  
Workbooks("220312_Workplan_PP_LA.xlsm").Worksheets("Workplan").Range("E6:F2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("C5")
  
Workbooks("220312_Workplan_PP_AP.xlsm").Worksheets("Workplan").Range("H6:I2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("E5")
  
Workbooks("220312_Workplan_PP_CM.xlsm").Worksheets("Workplan").Range("H6:I2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("E5")
  
Workbooks("220312_Workplan_PP_LA.xlsm").Worksheets("Workplan").Range("H6:I2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("E5")

Now I realise that the last range over-writes the first one. My question is, how can I copy them back to back? Also, I'd insist on keeping the code as much as possible the way it is.

Thanks a lot for your help!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
See first 3 rows, all 3 copies from different sources /paste in to same range "A5". It mean the very last copy remains.
VBA Code:
Workbooks("220312_Workplan_PP_LA.xlsm").Worksheets("Workplan").Range("C6:D2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("A5")
Similar situation to next 2 sets of 3 of copy/paste.
 
Upvote 0
Hi & welcome to MrExcel.
Not entirely sure what you mean by
how can I copy them back to back?
But if you want to copy the ranges, one below another try
VBA Code:
Workbooks("220312_Workplan_PP_CM.xlsm").Worksheets("Workplan").Range("C6:D2000").Copy _
  Workbooks("MO_LD.xlsm").Worksheets("MO").Range("A" & Rows.count).End(xlUp).Offset(1)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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