Article ID: 213477 - View products that this article applies to.
This article was previously published under Q213477
In Microsoft Excel, you can use a macro to concatenate the data in two adjacent columns and to display the result in the column to the right of the columns that contain your data. This article contains a sample Microsoft Visual Basic for Applications (VBA) macro (Sub procedure) to accomplish this.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Sample Visual Basic for Applications (VBA) macro
NOTE: The statement ActiveCell.Offset(0, 1).FormulaR1C1 can be replaced with the statement ActiveCell.Offset(0, 1).Formula. They can be used with equal success if you are using text and numbers only (not formulas). The R1C1 used at the end of the first statement refers to row one, column one and is the form used in examples in Help.
How to use the macro in Microsoft Office Excel 2007
How to use the macro in Microsoft Office Excel 2003 and in earlier versions of Excel
For more information about Visual Basic for Applications, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/226118/ )List of resources that are available to help you learn Visual Basic for Applications programming
Article ID: 213477 - Last Review: September 18, 2011 - Revision: 6.0