Concat 2 columns then paste into a third

Kriskros07

New Member
Joined
Sep 1, 2011
Messages
11
Hi!

Following on from a previous thread, can someone tell me how i can concatenate 2 columns of data into 1 and then copy/paste the results into a third column.

I need to do this in VBA Excel.

Kind Regards,
Chris
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try like this

Code:
Sub concat()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
With Range("C1:C" & LR)
    .Formula = "=A1&B1"
    .Value = .Value
End With
End Sub
 
Upvote 0
This is brilliant!

However, hoping not to sound unappreciative, is there any way of representing the column range as an indexed number, e.g where C1:C could be represented with a 3, instead. The issue is that the column i wish to paste into is likely to change however i can work out the relative position this range should be in given some other conditions. Alternatively if i could convert a number into a range of course...

Any further help very much appreciated.
 
Upvote 0
Maybe like this?

Code:
Sub concat()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
With Range(Cells(1, 3), Cells(LR, 3))
    .Formula = "=A1&B1"
    .Value = .Value
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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