none
VBA copy tables from other workbooks -- HELP PLEASE! RRS feed

  • Question

  • HELP!!!!

    I am trying to create a VBA that is able to retrieve information from 3 workbooks and go sheet by sheet and add them together, basically creating a aggregation of tables

    Conditions:

    3 workbooks Country1.xlsx, Country2.xlsx, Country3.xlsx.

    Each workbook has 5 sheets Sheet1, Sheet2, Sheet3, Sheet4, Sheet5

    Each sheet only has 1 table

    Each table has their own header & size, but within different workbooks they are the same (e.g., Country1.sheet1 table header/size is different from Country1.sheet 2 table, but Country1.sheet1 size/header is exactly the same as Country2.sheet1 table)

    Table 1: A to M

    Table 2: A to M

    Table 3: A to K

    Table 4: A to B

    Table 5: A to M

    HELP!!!

    Create a VBA that is able to combine Table1 content from each of the 3 workbooks and create a new table that basically has all that information, then on another worksheet do the same for Table2, Table3, Table4 and Table5.

    Note:

    The number of entries on each table may vary, meaning Country1.Sheet1 table may have 20 entries but Country2.Sheet1 may only have 4. So this is not a static size.

    The 3 workbooks are all on a specific folder within the desktop 'C:\Users\Dummy\Desktop\Folder1\Folder2\'

    The new workbook in on the same root but outside the last folder: 'C:\Users\Dummy\Desktop\Folder1\'

    Appreciate any help you can provide since I have been banging my head on the wall

    Thursday, February 6, 2020 3:41 PM

All replies

  • Does the destination workbook already exist (with Sheet1 ... Sheet5), or should the VBA code create that workbook?

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Thursday, February 6, 2020 4:10 PM