Macro?: Copy & Paste from Two Lists

okie_ryan

New Member
Joined
Jun 30, 2016
Messages
2
Greetings. I have two sets of data in the Sample below. I am looking for a way to automatically create the Outcome: each value in Column A paired with each value in Column B - creating two new datasets in Columns C and D.

The solution must work for much larger datasets. THANK YOU!!

Sample
AB
1UpRed
2DownYellow
3Red

<tbody>
</tbody>

Outcome
ABCD
1UpRedUpRed
2DownYellowUpYellow
3BlueUpBlue
4DownRed
5DownYellow
6DownBlue

<tbody>
</tbody>
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Perhaps :-

Code:
Dim rngA As Range, rngB As Range, r#
Set rngA = Range([A1], Cells(Rows.Count, 1).End(xlUp))
Set rngB = Range([B1], Cells(Rows.Count, 2).End(xlUp))
r = rngA.Rows.Count * rngB.Rows.Count
rngA.Copy [C1].Resize(r)
Range([C1], Cells(r, 3)).Sort Key1:=[C1], _
  Order1:=xlDescending, Header:=xlNo
rngB.Copy [D1].Resize(r)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,844
Members
449,411
Latest member
adunn_23

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