Vba code to combine 2 columns into a new column

jamesdean1379

Board Regular
Joined
Jun 11, 2014
Messages
55
Hey guys I have been trying to find a code that does what i want it to. I need to combine 2 columns into 1 new column and add text in between the two inputs. Probably not explaining too well so i have post pictures below showing what i am looking for.

Before
a2dh5c.jpg


AFTER
29gfyx4.jpg


I need it to make a new column and combine columns A and C and put ~UN inbetween them like above.

Any help with this will be greatly appreciated.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Something like this should do the trick:

Code:
Sub Combine()

    Dim lLastRow As Long

    lLastRow = Range("A" & Rows.Count).End(xlUp).Row

    Columns("B").Insert
    Range("B1") = "Combine"
    Range("B2:B" & lLastRow).FormulaR1C1 = "=RC[-1] & ""~NU"" & RC[1]"

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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