Concatenation of txt fields

Xarin

New Member
Joined
Mar 4, 2002
Messages
3
I need a simple VBA routine to concatenate two cells of information, such as last name in A1 cell with first name B1 cell. Then need it to perform a loop to continue through the two columns - doing the same thing to all of the data present. Any help would be appreciated.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Do you need a VBA solution? Can't you just, in cell C1, put =A1&" "&B1, and copy down as far as you need?
Richard
 
Upvote 0
Hi Xarin

As has been said you don't have to use a macro, but if you do I wouldn't use a Loop. Try this instead.It assumes your 2 columns to join are "A" & "B" and you want them joined in "C"

Sub JoinIt()
With Range("B2", Range("B65536").End(xlUp)).Offset(0, 1)
.FormulaR1C1 = "=RC[-2] & "" "" &RC[-1]"
Range("B2", Range("B65536").End(xlUp)).Offset(0, 1) = .Value
End With

_________________
Kind Regards
Dave Hawley
OzGrid Business Applications
Microsoft Excel/VBA Training
If it's Excel, then it's us!
This message was edited by Dave Hawley on 2002-03-05 21:50
This message was edited by Dave Hawley on 2002-03-05 21:52
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,924
Members
448,533
Latest member
thietbibeboiwasaco

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