Help with an macro to combine two rows

therealOXYD

New Member
Joined
Apr 13, 2018
Messages
6
Hi Gurus!
I need help with an macro to combine two rows. Put Cell B1 under A1, B2 under A2 and so on.

Do anyone ha an idea on how to do this?

Data:
[00-020P]R2A/B4/28U/00::0/0/0:9:0 Rx [00-020P]R2A/B4/31U/.02
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Tx [00-020P]R2A/B4/31U/.03
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Rx [00-020P]R2A/B4/31U/.04
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Tx [00-020P]R2A/B4/31U/.05
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Rx [00-020P]R2A/B4/31U/.06

<colgroup><col style="mso-width-source:userset;mso-width-alt:11300; width:232pt" span="2" width="309"> </colgroup><tbody>
[TD="width: 309"] [00-020P]R2A/B4/28U/00::0/0/0:9:0 Tx[/TD]
[TD="width: 309"] [00-020P]R2A/B4/31U/.01[/TD]

</tbody>



Result im after:
[00-020P]R2A/B4/28U/00::0/0/0:9:0 Tx
[00-020P]R2A/B4/31U/.01
[00-020P]R2A/B4/28U/00::0/0/0:9:0 Rx
[00-020P]R2A/B4/31U/.02
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Tx
[00-020P]R2A/B4/31U/.03
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Rx
[00-020P]R2A/B4/31U/.04
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Tx
[00-020P]R2A/B4/31U/.05
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Rx
[00-020P]R2A/B4/31U/.06
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Theres no space in original data just
[00-020P]R2A/B4/28U/00::0/0/0:9:0 Tx [00-020P]R2A/B4/31U/.01
[00-020P]R2A/B4/28U/00::0/0/0:9:0 Rx [00-020P]R2A/B4/31U/.02
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Tx [00-020P]R2A/B4/31U/.03
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Rx [00-020P]R2A/B4/31U/.04
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Tx [00-020P]R2A/B4/31U/.05
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Rx [00-020P]R2A/B4/31U/.06
 
Upvote 0
Is there a space between the rows?
 
Upvote 0
Hi!
Sorry the confusion. I cant find a button to edit original post. Its like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:0Tx
[/TD]
[TD][00-020P]R2A/B4/31U/.01
[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:0Rx
[/TD]
[TD][00-020P]R2A/B4/31U/.02
[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:1Tx
[/TD]
[TD][00-020P]R2A/B4/31U/.03
[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:1Rx
[/TD]
[TD][00-020P]R2A/B4/31U/.04
[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:2Tx
[/TD]
[TD][00-020P]R2A/B4/31U/.05
[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:2Rx
[/TD]
[TD][00-020P]R2A/B4/31U/.06
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Hi!
Sorry the confusion. I cant find a button to edit original post. Its like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:0Tx[/TD]
[TD][00-020P]R2A/B4/31U/.01[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:0Rx[/TD]
[TD][00-020P]R2A/B4/31U/.02[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:1Tx[/TD]
[TD][00-020P]R2A/B4/31U/.03[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:1Rx[/TD]
[TD][00-020P]R2A/B4/31U/.04[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:2Tx[/TD]
[TD][00-020P]R2A/B4/31U/.05[/TD]
[/TR]
[TR]
[TD][00-020P]R2A/B4/28U/00::0/0/0:9:2Rx[/TD]
[TD][00-020P]R2A/B4/31U/.06[/TD]
[/TR]
</tbody>[/TABLE]
The cells didnt show :laugh:

Two cells concenated from one row gived this lines. But i need them in one column, as if there was an return in between :[00-020P]R2A/B4/28U/00::0/0/0:9:0 Tx \r [00-020P]R2A/B4/31U/.01



[00-020P]R2A/B4/28U/00::0/0/0:9:0 Tx [00-020P]R2A/B4/31U/.01
[00-020P]R2A/B4/28U/00::0/0/0:9:0 Rx [00-020P]R2A/B4/31U/.02
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Tx [00-020P]R2A/B4/31U/.03
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Rx [00-020P]R2A/B4/31U/.04
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Tx [00-020P]R2A/B4/31U/.05
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Rx [00-020P]R2A/B4/31U/.06
 
Upvote 0
So this is what you have in A1:B6?

[00-020P]R2A/B4/28U/00::0/0/0:9:0 Tx [00-020P]R2A/B4/31U/.01
[00-020P]R2A/B4/28U/00::0/0/0:9:0 Rx [00-020P]R2A/B4/31U/.02
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Tx [00-020P]R2A/B4/31U/.03
[00-020P]R2A/B4/28U/00::0/0/0:9:1 Rx [00-020P]R2A/B4/31U/.04
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Tx [00-020P]R2A/B4/31U/.05
[00-020P]R2A/B4/28U/00::0/0/0:9:2 Rx [00-020P]R2A/B4/31U/.06
 
Upvote 0
Try this, it assumes the data starts in A1 on the active sheet and outputs to a new sheet, though that can be changed.
Code:
Sub MoveStuffAboutABit()
Dim arrIn As Variant
Dim arrOut()
Dim I As Long

    arrIn = Range("A1").CurrentRegion
    ReDim arrOut(1 To UBound(arrIn) * 2, 1 To 1)
    
    For I = LBound(arrIn) To UBound(arrIn)
        arrOut((I * 2) - 1, 1) = arrIn(I, 1)
        arrOut(I * 2, 1) = arrIn(I, 2)
    Next I
    
    Sheets.Add
    
    ActiveSheet.Range("A1").Resize(UBound(arrOut, 1), UBound(arrOut, 2)).Value = arrOut
    
End Sub
 
Upvote 0
Try this, it assumes the data starts in A1 on the active sheet and outputs to a new sheet, though that can be changed.
Code:
Sub MoveStuffAboutABit()
Dim arrIn As Variant
Dim arrOut()
Dim I As Long

    arrIn = Range("A1").CurrentRegion
    ReDim arrOut(1 To UBound(arrIn) * 2, 1 To 1)
    
    For I = LBound(arrIn) To UBound(arrIn)
        arrOut((I * 2) - 1, 1) = arrIn(I, 1)
        arrOut(I * 2, 1) = arrIn(I, 2)
    Next I
    
    Sheets.Add
    
    ActiveSheet.Range("A1").Resize(UBound(arrOut, 1), UBound(arrOut, 2)).Value = arrOut
    
End Sub

This works. BIG BIG thanks.
 
Upvote 0

Forum statistics

Threads
1,226,224
Messages
6,189,728
Members
453,566
Latest member
ariestattle

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