+ Reply to Thread
Results 1 to 9 of 9

Combining multiple workbooks into a single workbook with each on separate sheet

  1. #1
    Registered User
    Join Date
    10-31-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    4

    Combining multiple workbooks into a single workbook with each on separate sheet

    Hello,

    New to this site and tried not to post but can not find the exact solution. I am trying to combine multiple workbooks into a single workbook but with each workbook being on a new sheet. I used the code from the post at:
    http://www.excelforum.com/excel-prog...-workbook.html
    This works except it puts all the data on the first sheet. I would like to have each workbook on a separate sheet. I use these spreadsheets to track training for my unit so it is always changing. Thanks in advance for the help.

    William Parker
    Last edited by JBeaucaire; 11-01-2012 at 11:08 AM. Reason: Corrected URL

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    'WORKBOOKS TO SHEETS
    Here's a macro for collecting data from all files in a specific folder. This version copies the sheet in as a whole.

    The parts of the code that need to be edited are colored to draw your attention.
    Last edited by JBeaucaire; 12-27-2019 at 10:39 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-31-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    Thank You, JBeaucaire. That worked perfectly.

  4. #4
    Registered User
    Join Date
    03-14-2012
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    I'm trying to use this as well but I am working in a Citrix environment.

    When it sets OldDir = CurDir then "OldDir" is listed as H:\MY DOCUMENTS regardless of the path that I am using above.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    My apologies. I just updated the macro on that page, grab it again. There is no need to be changing directories like that. I hadn't updated that macro in years, and it needed attention.

  6. #6
    Registered User
    Join Date
    03-14-2012
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    Thanks for updating it.

    This is what I am using now, and it's just looping without actually doing anything to the files.

    I have named my file "Consolidate files.xlsx" and here's an example of one of the file names: Inventory Cycle Count (M4-A01 Thru M4-D10) 4-04-2012.xls

    Due to the file name's length I did change the shtAdd = Mid(fName, 23, 21) to a Mid function.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    Use F8 to step through the macro one command at a time. Specifically when you get the:
    Please Login or Register  to view this content.
    ...hover your mouse over fPath and fName, do you see the values in those variables, are they correct? When you F8 past that line, does it OPEN the file?

    The macro just copies the first sheet in the opened file into the main workbook.

  8. #8
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    Hi JBeaucaire.

    Dont want to hijack this thread, I have posted a similar issue, can you please look at it if possible?

    http://www.excelforum.com/excel-prog...pend-data.html

    I also read through your site (which btw is awesome and is tons of help for newbies like me) and this page has kind of what I am looking for: https://sites.google.com/a/madrocket...s-to-one-sheet

    But I want to be able to browse and choose the workbooks instead of all the files in a given folder.

    Please let me know if it is inappropriate to post a reply like this and if it hijacks the thread, I will delete it.

    Regards
    Last edited by JBeaucaire; 12-27-2019 at 10:39 PM.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Combining multiple workbooks into a single workbook with each on separate sheet

    If you click on the FORUM RULES link above, you can see for yourself what rules you must follow. You should not post new questions in other people's threads, but open a new thread of your own (as you did) and include a link to other threads in your post that you find particularly relevant to your question.

    I'll visit your other thread.

+ 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