+ Reply to Thread
Results 1 to 11 of 11

Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

  1. #1
    Registered User
    Join Date
    09-11-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Hi,

    I have some excel spreadsheets that have lots of tabs. I would like to copy 2 columns from each tab so that the data is on one tab. The Columns are D & F.

    I know I have to insert a Macro but I need to know what the code would be and also how to actually do this in excel, e.g how to insert the Macro. I have done this before, following some insrtuctions from another thread on here but I can't remember how to do and can't find the original thread!

    Thanks.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Carrie,
    It would be easier if you could attach sample book. We can then attach the macro(code) in to your sheet. Please remove any confidential info, just a sample, not the entire data.

  3. #3
    Registered User
    Join Date
    09-11-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Hi,

    Please find a Sample file below. The only thing that is the same as my spreadsheet is the header. I hope this is ok. Thanks.

    Sample.xls

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Carrie,
    Okay!

    "I would like to copy 2 columns from each tab so that the data is on one tab. The Columns are D & F."
    You have for instance "Cheshire" in column "D" and "Carrie" in column "E". How do you want to combine these two tabs
    in to one? Do you want a comma, period & to use as joiner. Please show me in example. You have dozens of sheets in the workbook. Do you wish to combine all in a single summary sheet?

  5. #5
    Registered User
    Join Date
    09-11-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    I've attached the sample sheet which now includes a Master Tab. Ideally I would just like two columns, which has all of the information from Columns D & F from all of the tabs. I hope this makes sense!
    Sample.xls
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-29-2012
    Location
    Madison, WI
    MS-Off Ver
    MS Office 2010 (Excel, Word, Access)
    Posts
    72

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Carrie,
    I'm new around here, and I'm not 100% sure this code will work in Excel 2007 the same way it will in 2010, but it should be pretty similar.

    Please Login or Register  to view this content.
    Here's hoping that I put that together in a way that formats decently here.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Here is the code. Please see attached

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by AB33; 11-29-2012 at 11:31 AM. Reason: Duplicate

  8. #8
    Registered User
    Join Date
    09-11-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Thanks Jason.

    This may seen like a really stupid question, but can you also supply instructions on how to add this code onto my spreadsheet, literally step by step?

    Thanks.

  9. #9
    Registered User
    Join Date
    11-29-2012
    Location
    Madison, WI
    MS-Off Ver
    MS Office 2010 (Excel, Word, Access)
    Posts
    72

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Quote Originally Posted by Carrie1990 View Post
    Thanks Jason.

    This may seen like a really stupid question, but can you also supply instructions on how to add this code onto my spreadsheet, literally step by step?

    Thanks.
    Not stupid at all, Carrie. To work with the code that either AB33 or myself included (and AB's might well work better for you), you'll need to make sure that your worksheet is Macro Enabled (yours is).

    Then you either go to the Developer tab in your ribbon and click on Visual Basic, or you hit Alt-F11 (I prefer the keyboard shortcuts, myself). If you don't have the Developer tab, go ahead and add it. Even if you prefer your keyboard shortcuts like I do, it helps to have the ribbon tab.

    Then, under the default VisualBasicProject that you'll see on the left-hand of your screen, you should find a part of the tree labeled "Modules."

    Right-click, scroll down to "Insert" -> Module

    Copy/Paste the code into the blank coding window that will appear.

    You can then add a custom button to your Quick Access Toolbar that will activate the macro; if you need instructions for that, please let me know!

    Also let me know if you run into any problems trying to use my code, and I'll try to figure out what I've screwed up in the course of putting it together.

    Have a great day!

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    Carrie,
    As per Jason's instruction(Thanks Jason by the way).
    You could also use Alt+F8 while you are in the excel page- Then choose Run macro

  11. #11
    Registered User
    Join Date
    09-11-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Setting Up and Creating a Macro to copy data from multiple tabs onto one main tab

    This has worked perfectly, thanks for all your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1