+ Reply to Thread
Results 1 to 11 of 11

Consolidate all sheets across multiple workbooks

  1. #1
    Registered User
    Join Date
    01-08-2014
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Consolidate all sheets across multiple workbooks

    Hi All,

    I came across the following code, which does exactly what i want. It opens up all workbooks in a specified folder, and consolidates these into one. Each worksheet data is added below that of the previous workbook.

    https://sites.google.com/a/madrocket.../wbs-to-sheets

    I have changed this to suit my workbook which has the header rows starting in row 6, but is now giving an error due ot the copy area not being the same size as the past area. It appearsto be copying columns A:M and trying to paste this into the main workbook in columns A:N.

    can anyone see where i have went wrong? I admit that i am new to this, and struggling to fully understand every step of this code.

    Please Login or Register  to view this content.

  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: Consolidate all sheets across multiple workbooks

    The original code cycled through ALL the worksheets in the opened workbook and copied all the data from all the sheets. The code to Loop through the multiple sheets appears to have been removed from your code. It was the wsData reference.

    Does your opened workbooks have one sheet of data, or multiple sheets of data?
    _________________
    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
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Consolidate all sheets across multiple workbooks

    No, I'm wrong, I see it there now. The code as it looks above seems correct.


    You mentioned an error? What is the error exactly? When you DEBUG on the error, which line of code is highlighted?

  4. #4
    Registered User
    Join Date
    01-08-2014
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Consolidate all sheets across multiple workbooksorkbooka

    Hi,

    Sorry. I must have cut something during an edit. My workbooks have multiple sheets, and all of these need merged with the exception of the first one. I did try to adjust the code to skip the first sheet, but then reversed this change. I must have missed something when reversing this alteration.

    Thanks

  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: Consolidate all sheets across multiple workbooks

    See post #3.

  6. #6
    Registered User
    Join Date
    01-08-2014
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Consolidate all sheets across multiple workbooksorkbooka

    The error is "1004: copy area is not the same size of the paste error. Try selecting a single cell..."

    This error appears to happen at the following line

    Please Login or Register  to view this content.
    If I look at what is currently highlighted on this line, it appears to be trying to copy the range A:M from the currently opened workbook into a range A:N into the main workbook. So these are not the same size, and are indeed 1 column size different.

    As I have confessed, I am not 100% about that this code is on this line is doing. But my gut is telling me it is something to do with the range we have selected in the second parenthesis. I could be way of the mark though.

    Thanks.

  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: Consolidate all sheets across multiple workbooks

    Take the ' out of the 'NR

  8. #8
    Registered User
    Join Date
    01-08-2014
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Consolidate all sheets across multiple workbooks

    Apologies, that should never have been there as it is not actually present in my code. This is a typo as I am currently stuck using a tablet. I will repost my full code here tomorrow.

    I will also try to adapt this so that we are not copying the full row, but rather just select a column range. And see what difference this makes.

    Thanks,

    Andrew

  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: Consolidate all sheets across multiple workbooks

    That would perhaps be:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-08-2014
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Consolidate all sheets across multiple workbooks

    Issue Solved.

    I had a column which was not 'cleansing' after each run, so the spreadsheet would eventually hit its limit and run out of destination rows.

    Thanks

  11. #11
    Registered User
    Join Date
    02-10-2015
    Location
    seattle, wa
    MS-Off Ver
    13
    Posts
    1

    Re: Consolidate all sheets across multiple workbooks

    what was the final code?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Needing a Macro Solution to Consolidate Several Data Sheets in various Workbooks into One
    By robbfamily in forum Excel Programming / VBA / Macros
    Replies: 36
    Last Post: 08-01-2014, 10:57 AM
  2. VBA for consolidate sheets into one workbook from list of workbooks.
    By sureshpunna in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2013, 07:13 AM
  3. Consolidate from multiple workbooks
    By delt127 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2011, 12:44 PM
  4. [SOLVED] How to split and consolidate sheets into new workbooks
    By Xluser@work in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-21-2006, 05:17 AM
  5. Consolidate different sheets to different workbooks
    By markx in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-26-2005, 11:06 AM

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