+ Reply to Thread
Results 1 to 10 of 10

copy data from multiple worksheets into master workbook

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    5

    copy data from multiple worksheets into master workbook

    Hi there,
    I've seen this sort of answered on an old closed thread but i'm hoping someone can help me some with code.
    I wish to have a 'master.xlsx' which whe I run a macro, allows me to search and open another workbook 'Entry.xlsx'. The Entry workbook has a number of tabs 'data1', 'data2' that I wish to copy and paste from eache sheet and add to the 'master.xlsx'. The master has the same tabs 'data1' etc. The macro should be able to add data (it's basically compliling 'entry' sheets after every month so the master has the full year data).

    hope someone can help. The following code, opens the workbook, but does not copy the data??

    hope someone can help
    Please Login or Register  to view this content.
    Last edited by arlu1201; 05-09-2012 at 04:35 AM. Reason: Please put code tags in future.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: copy data from multiple worksheets into master workbook

    Should the data from Entry.xlsx - data1 be copied to the master file data1, and entry.xlsx - data2 be copied to data2, etc?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-09-2012
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy data from multiple worksheets into master workbook

    sorry, yes the data is to be copied to the same named tab in the master workbook

    cheers

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: copy data from multiple worksheets into master workbook

    Try this code
    Please Login or Register  to view this content.
    Put it in a standard module.

  5. #5
    Registered User
    Join Date
    05-09-2012
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy data from multiple worksheets into master workbook

    Hi Arlette,
    Thank you for the code, however it fails at the line
    Please Login or Register  to view this content.
    the error is 'subscript out of range'

    hope you can help

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: copy data from multiple worksheets into master workbook

    It will be good if you attach the file that you are using along with the code. Even a sample file with dummy data will do.

  7. #7
    Registered User
    Join Date
    05-09-2012
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy data from multiple worksheets into master workbook

    please find attached dummy files. I am using exactly the code you provided.

    regards
    Attached Files Attached Files

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: copy data from multiple worksheets into master workbook

    The code worked fine at my end. Did you put the code into the Master file? If you dont, you will get the error that you got above.

    In the master file,
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button.

  9. #9
    Registered User
    Join Date
    05-09-2012
    Location
    scotland
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: copy data from multiple worksheets into master workbook

    Thank you arlu, I was sroring it in personal macro book...doh!

    Also, I have to decalare 'lrow' as Dim As Variant at the start so it would work

    thank you for your help again

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: copy data from multiple worksheets into master workbook

    You can declare it as long.
    Glad it worked.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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