Microsoft Excel Training Videos

Combining text in Excel using macros and functions

Combining text in Excel using macros and functions to manipulate text imported from a database or text file
The macro shows how you can combine values from two columns into a third column with a space between them by using (" "). The brackets have been added just for clarity. In this example we have combined the first name and the last name to create a full name which can be quite useful in practical situations.This operation is performed while the value of Cells(x,2) is not blank. The variable x is used to track the current row number, and increasing x moves the operation to the next row. The columns are specified by the nonvariable values of 1, 2, and 3, which represent columns A, B, and C, respectively. At the same time we have also demonstrated how to achieve the same effect by using the concatenate Excel text function. This kind of situation is encountered many times in a software like Excel. Depending on your comfort level, you may decide accordingly. Last not least, this serves as an elegant demonstration of the use of a 'do while' loop in a macro in Microsoft Excel.
Combining text in Excel using macros and functions