Combine column text and replace using VBA in Microsoft Excel

In this article, we will create a macro to combine text from two consecutive columns to a single column.

Raw data consists of First name and Last name, which we want to merge into a single column.


Code explanation

IntRow = Cells(Rows.Count, 1).End(xlUp).Row

The above code is used to get row number of the last cell.

Cells(i, 1) = Cells(i, 1) & " " & Cells(i, 2)

The above code concatenates values from cell in column 1 and column 2.


The above code is used to delete the second column.



Please follow below for the code

Option Explicit

Sub CombiningData()
'Declaring variables
Dim i As Integer, IntRow As Long

'Disabling screen updates
Application.ScreenUpdating = False

'Getting row number of last cell
IntRow = Cells(Rows.Count, 1).End(xlUp).Row

'Looping from 13th row to last row
For i = 13 To IntRow
    'Concatenating the value of two consecutive cells
    Cells(i, 1) = Cells(i, 1) & " " & Cells(i, 2)

'Assigning value to cell A12
Range("A12") = "Name"

'Deleting second column

'Auto adjusting the size of cells in columns

'Enabling screen updates
Application.ScreenUpdating = True
End Sub


If you liked this blog, share it with your friends on Facebook. Also, you can follow us on Twitter and Facebook.

We would love to hear from you, do let us know how we can improve our work and make it better for you. Write to us at

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.