Macro to copy 2 row and put them in 2 columns

dee101

Active Member
Joined
Aug 21, 2004
Messages
282
I need to take all the data in column A and put the first 2 rows in B1 and C1 then put the next 2 rows in B2 and C2 and the way down column A, like the example below.

From this
<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">1A</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">1B</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">2A</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">2B</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">3A</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">3B</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";">4A</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style=";">4B</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style=";">5A</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style=";">5B</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style=";">6A</td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style=";">6B</td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style=";">7A</td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style=";">7B</td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style=";">8A</td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style=";">8B</td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style=";">9A</td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style=";">9B</td></tr><tr ><td style="color: #161120;text-align: center;">19</td><td style=";">10A</td></tr><tr ><td style="color: #161120;text-align: center;">20</td><td style=";">10B</td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br />

To this
<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">1A</td><td style=";">1A</td><td style=";">1B</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">1B</td><td style=";">2A</td><td style=";">2B</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">2A</td><td style=";">3A</td><td style=";">3B</td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">2B</td><td style=";">4A</td><td style=";">4B</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">3A</td><td style=";">5A</td><td style=";">5B</td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">3B</td><td style=";">6A</td><td style=";">6B</td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";">4A</td><td style=";">7A</td><td style=";">7B</td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style=";">4B</td><td style=";">8A</td><td style=";">8B</td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style=";">5A</td><td style=";">9A</td><td style=";">9B</td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style=";">5B</td><td style=";">10A</td><td style=";">10B</td></tr><tr ><td style="color: #161120;text-align: center;">11</td><td style=";">6A</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">12</td><td style=";">6B</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">13</td><td style=";">7A</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">14</td><td style=";">7B</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">15</td><td style=";">8A</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">16</td><td style=";">8B</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">17</td><td style=";">9A</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">18</td><td style=";">9B</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">19</td><td style=";">10A</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">20</td><td style=";">10B</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br />
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
This macro should do what you want...
Code:
Sub RedistributeColumnA()
  Dim X As Long
  For X = 1 To Cells(Rows.Count, "A").End(xlUp).Row Step 2
    Cells((X + 1) / 2, "B").Value = Cells(X, "A").Value
    Cells((X + 1) / 2, "C").Value = Cells(X + 1, "A").Value
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,334
Members
452,907
Latest member
Roland Deschain

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