Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2007 Concatenate column 1

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

I have data in an excel file that I want concatenated from 2 columns.
I have found several examples that work by creating references.

My problem is that I want to delete the source columns after concatenation.

Example
A[tab][tab][tab]B[tab][tab][tab]C
"ABC"[tab]"DEF"[tab][tab]"ABCDEF"

Delete columns A & B.
Column A should now have "ABCDEF"

Thanks.

If at first you don't succeed, then sky diving wasn't meant for you!
 
I think I've figured out one way to accomplish this using paste special.

Code:
lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row

Range("C2:C" & lngLastRow).Value = "=A2 & B2"
Columns("C:C").Select
Selection.Copy
Columns("D:D").Select
Selection.pastespecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
     :=False, Transpose:=False
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft

If at first you don't succeed, then sky diving wasn't meant for you!
 
Hi,

Well you have the formula for concatenation, like =A2&B2.

So after copy/paste down column C...

SELECT Column C

COPY

Right-Click in the selection and select PASTE VALUES.

Proceed to delete columns A & B.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Thanks for the reply Skip.


If at first you don't succeed, then sky diving wasn't meant for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top