+ Reply to Thread
Results 1 to 9 of 9

have multiple tables on separate sheets, how to combine

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    have multiple tables on separate sheets, how to combine

    i have this routine that is not working on tables. How can I copy tables from multiple sheets and have them combine into one?

    this is not working:

    Please Login or Register  to view this content.
    the problem is that this copies only the text and not the structure of the table (like banded rows, header row with drop downs, etc)

    so i did some research and found this link

    i expected this snippet of code to work, but i get an error that the subscript is out of range. i went to the "Purchase Requisitions" sheet and verified the name of the table so why isn't this working"

    Please Login or Register  to view this content.
    the sheets that have the tables are: "Purchase Requsitions", "Outstanding POs", "Open POs", "Closed POs" and "Archived POs". All the tables go to the "Summary" sheet.
    Last edited by dmcgov; 07-25-2017 at 08:49 AM. Reason: added sheets

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: have multiple tables on separate sheets, how to combine

    Can you upload sample file with small amount of data?

    Normally what you'd need to do is, to copy databodyrange of each table. Paste as value. Convert entire range into new table range.

    You can find where I did something like above in thread below (post #13 is where convert range to table is done)
    https://www.excelforum.com/excel-pro...one-sheet.html
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  3. #3
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have multiple tables on separate sheets, how to combine

    so i read your post and the link. so what i have that is working so far is this:

    Please Login or Register  to view this content.
    The only issue is that the tables are right below each other and i would like a blank line in between. how can i do that?

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: have multiple tables on separate sheets, how to combine

    So you are actually not combining multiple table into one table, I take it?

    But copying tables that reside in separate sheet into single sheet but as individual table?
    If you are copying table as is, I'd recommend just copying entire .ListObject and pasting. Instead of copying range and pasting as value.

    At any rate, with your code try, Rows.Count + 1 instead of just Rows.Count

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have multiple tables on separate sheets, how to combine

    so here is what i tried (got an error)

    Please Login or Register  to view this content.
    when i ran it, i got a "Run Time Error 1004: Application-defined or object-defined error". what did i do wrong>?
    Last edited by dmcgov; 07-25-2017 at 10:30 AM. Reason: added punctuation

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: have multiple tables on separate sheets, how to combine

    Can you upload a sample workbook with sanitized data? It'll help in optimizing your code.

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have multiple tables on separate sheets, how to combine

    sorry it took so long to do this, but here it is
    Attached Images Attached Images
    Attached Files Attached Files

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: have multiple tables on separate sheets, how to combine

    Ah, my bad on Rows.Count + 1. I forgot that that portion counts entire worksheet row range.

    You should use .Offset(1).PasteSpecial

    However, what are you trying to copy to "Summary" sheet from "Outstanding POs"? Only partial filtered data or entire table?

    Below code is to copy entire table.

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have multiple tables on separate sheets, how to combine

    Thanks CK76, that did the trick. i put the rest of the sheets in the code as well. i like it that it keeps the format of the table (like date and dollars).

    here is the final code:

    Please Login or Register  to view this content.

+ 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] Need to combine separate sheets into a log - Consolidation
    By taylorsm in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-10-2017, 10:54 AM
  2. Several sheets, several tables, combine and lookup
    By NoSleepForMe in forum Excel General
    Replies: 0
    Last Post: 02-06-2017, 04:26 AM
  3. Combine Vlookup different tables (sheets)
    By sab128 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-08-2016, 07:04 AM
  4. Replies: 1
    Last Post: 02-26-2016, 12:05 PM
  5. [SOLVED] Macro needed to Concatenate data in 2 separate tables of 2 separate sheets
    By 823 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-08-2015, 02:02 PM
  6. How do I combine data tom 2 separate sheets
    By njbula in forum Excel General
    Replies: 1
    Last Post: 01-09-2015, 01:26 AM
  7. Pivot Tables - need to do separate pivot tables for multiple sheets in same format
    By tconnell1965 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 07:04 AM

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