How to merge values in two columns into one column

I Just recap my memory about merging the data in two columns into One column using the macro in excel 2010

here is the sample i worked on :

I have first name and last name in A and B columns and now I want it in Column C as full name (First name and last name )


How to write macro for this :

1. Open excel sheet
2.make sure you have the first worksheet name as Sheet1
3. Enter some names in Columns A and B starting at A1 and B1
3.Press ALT+F11 (This is to open VBA Code window)
4. use the code below or type in to code window
5. Run the macro and see in Column C ( The full names should appear in Column C)


Sub mergenames()

Sheets("Sheet1").Select
Range("C1").Select

Do Until Selection.Offset(0, -2).Value = ""
Selection.Value = Selection.Offset(0, -2).Value & " " & Selection.Offset(0, -1)
Selection.Offset(1, 0).Select
Loop

Range("A1").Select
End Sub




Comments

Popular Posts