• About
  • Contact
  • Privacy Policy
  • Submit For Review
  • Template Gallery
  • Excel 2016 Udemy Course
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

TheAppTimes

App Reviews, Tutorials, & Gadget News Hub

  • Gadgets
  • How To
  • Mobile Apps
  • Software and Web Apps
  • Buying Guides
  • Show Search
Hide Search
Home » How To » Macro to Concatenate Columns in Excel 2010

Macro to Concatenate Columns in Excel 2010

September 10, 2010

We have been working on an Excel project for some time now and when creating a database we encountered a problem. We had to merge the contents of two cells and doing this manually was time consuming due to the huge volume of records. We decided to put our VBA skills to the test and came out with this neat little macro to concatenate columns which I hope will be of help to you. Don't forget to check out the other macros we have on our site.

  • Tip: Tip: If you'd like to learn about how to create macros without writing them from scratch, check out our tutorial on Creating Macros Using the Macro Recorder.

Macro to Concatenate Columns in Excel 2010

Basic Macro Info

Basic Macro Info

Level of Difficulty

Easy

Works On

Excel 2007, 2010

Description

This macro will allow a user to concatenate two columns.

Code:

Sub Concatenate_Column()
Do While ActiveCell <> ""
ActiveCell.Offset(0, 1).FormulaR1C1 = _
ActiveCell.Offset(0, -1) & " " & ActiveCell.Offset(0, 0)
ActiveCell.Offset(1, 0).Select
Loop
End Sub

How to Use the Macro

1. Copy the code.

2. Open Excel 2010.

3. Press Alt + F11 to enter the Visual Basic Editor.

4. If necessary, press Ctrl + R to show the Project Explorer.

5. Right-click desired file on left (in bold).

6. Choose Insert -> Module.

7. Paste code into the right pane.

8. Press Alt + Q to close the VBE.

9. Save the workbook in the XLSM format.

10. Select the Developer tab. (If you have a problem displaying the Developer tab, please read our post How to Activate the Developer Tab in Excel 2010.

ALSO READ:  How to Save Thumbnail Preview of Excel Workbooks

11. On the Developer tab, in the Code group, click Macros.

12. In the Macro dialog box, select the macro and click Run.

Sample Workbook with Macro
To test the macro, please download the sample file Excel VBA Concatenate.xlsm

COURSE RECOMMENDATIONS

If you need to get a deeper understanding of Excel Macros, we recommend the following courses at Udemy.

Excel With Excel Pivot Tables: GetPivotData & Macros

GetPivotData and Macros

This course teaches you in simple terms how to create a Macro to automate different Pivot Table commands. Additionally, you can learn how to use the GETPIVOTDATA formula in a Pivot Table to create custom reports that are not available with a Pivot Table. The course offers downloadable workbooks, two business case studies, and simple quizzes to test your understanding of the materials you studied. The course is available for $49.

Take the Course Now!

Our second course recommendation is a rather simple one that teaches you the basics of macros and how to record macros. The details of the course are given below.

Microsoft Excel - Power Of Macros In 60 Minutes

Power of Macros

This course teaches you in simple terms the basics of macros & macro recording; elements of the macro recorder; recording simple & complex macros; optimizing a recorded code with some VBA lines and includes helpful examples for hands on training. The course is available for $19.

Take the Course Now!
Tweet
Share1
WhatsApp
Pin
Buffer
1 Shares
Tweet
Share1
WhatsApp
Pin
Buffer
1 Shares

Filed Under: How To Tagged With: excel how to, excel macros

You May Also Like

Ways to Use Excel Mobile - TATFI
10 Creative Ways to Use Excel Mobile in your Business
How to Get Rid of the Paste Options Menu in Word, Excel and PPT
How to Get Rid of the Paste Options Menu in Word, Excel and PPT
How to Calculate Number of Days Between Two Dates in Excel
How to Calculate Number of Days Between Two Dates in Excel

About Adeline Gear

Adeline is a tech enthusiast who loves exploring the latest tools and applications in the marketplace. She also loves her Android and spends time reviewing apps and playing games when she has the time.

Reader Interactions

Comments

  1. jefferis says

    August 31, 2011 at 11:15 pm

    Hi, I’m trying this macro in Excel 2011 and am getting this error:
    Compile error expected =
    Or if I separate sub concatenate I get a syntax error
    Sub Concatenate_Column() <— arrow points here

    ActiveCell.Offset(0, 1).FormulaR1C1 = _ //these two lines highlighted in red
    ActiveCell.Offset(0, -1) & ” ” & ActiveCell.Offset(0, 0)

    Reply
    • Eddie Gear says

      September 2, 2011 at 12:44 pm

      Did you try the code as given in the post without making any changes. Because It works fine as is. But if you have made changes, could you provide us with your complete code so we can try and help you out.

      Reply

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Hottest New Gadgets!

Amazfit Falcon Smartwatch - TATFI

The Amazfit Falcon is a Military Grade Smartwatch with Premium Looks and Great Features

Couchmaster Cyboss Ergonomic Couch Desk - TATFI

Couchmaster Cyboss is an Ergonomic Desk to Keep Off Neck Pain

Philips Hue Festavia String Lights - TATFI

Add a Bit of Sparkle to Your Christmas Tree with Philips Hue Festavia String Lights

Samsung Galaxy Tab A7 Lite Kids Edition - TATFI

This Kid Friendly Tablet from AT&T is a Thoughtful Gift for Your Little One This Christmas

Is An iPhone Really Worth It - TATFI

Is an iPhone is Really Worth It?

Devices You Might Want to Try - TATFI

4 Fantastic Devices You Might Want to Try

Amazon Kindle 2022 - TATFI

Meet the Amazon Kindle 2022 – Packed with New Features

Popular Tags

android android apps android games android how to apple casino games chrome extensions excel excel how to facebook gadgets gaming gmail google instagram ios apps ios games ios how to ios tips ipad iphone kids apps learn excel management microsoft music apps new releases outlook how to photo apps powerpoint powerpoint how to productivity Samsung security smartphone smartphones software tablet tablets twitter web browsers windows 10 word how to xbox youtube

Disclosure

TheAppTimes is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.
Tips to Boost Your Ranking and Sales on Etsy - TATFI

5 Ways to Boost Your Ranking and Sales on Etsy

PunchBee Time Management App - TATFI

Know How You Spend Your Time with PunchBee

DevOps Model Explained - TATFI

The Complete Guide to DevOps: How the Model Works and Who It Benefits

Approaches to Digital Marketing - TATFI

Blending Technical and Content-Centric Approaches to Digital Marketing

Tech Tips For Startups - TATFI

Useful Tech Tips For Startups

Boox Tab X Android eReader - TATFI

Boox Tab X is an Android eReader That Helps You Do More Than Just Read

Best e Readers to Buy in 2023 - TATFI

5 Best eReaders to Buy in 2023

Best Translation Apps for Android - TATFI

5 Great Translation Apps for Android

Dynamic Island Feature on Your Android - TATFI

How to Get the Dynamic Island Feature on Android

Connected TV Advertising In 2023 - TATFI

5 Things You Need To Know About Connected TV Advertising In 2023

Smart Cost Cutting Strategies for SMEs - TATFI

5 Smart Cost Cutting Strategies for SMEs

Technologies behind the online casino world - TATFI

The Latest Technologies Behind the Online Casino World

TheAppTimes © 2023 // Runs on StudioPress