Link to home
Start Free TrialLog in
Avatar of Skylar
Skylar

asked on

How to Merge all Excel Tables into a single Table.

I have excel files in a single folder.  each of those excel files has multiple sheets with data, the data are in form of simple data and "Excel Tables" like shown in the screenshot.

User generated image
I need to marge all of the Tables only into a single Table in a master Sheet.  

So, I need help with a code that loops through all workbooks in a folder and searches for Tables and then combines all of the table into one giant table and puts this giant table into a new workbook. all of the tables has the identical number of columns and column headers.  the column headers should be duplicated in the merged Table.

I have also attached the two example excel files that have tables in them.

I am doing this manually. I got some codes from searching, but they are all combining everything and I could not find something particular that combines only Tables  i would greatly appreciate any help to automate this using VBA.
Book1.xlsx
Book2.xlsx
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Will the master file be in the same folder?

Will each sheet contain only one Table?
ASKER CERTIFIED SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Skylar
Skylar

ASKER

Roy,  

Thank you so much.  It worked.

Only it did not put the headers at the top, which i can put manual. but would have been great if the code would have put the header from any of the tables. because all headers are the same in all tables.
I could change the code to copy the first Table with headers, I just thought it simpler to prepare the master sheet manually first.
Avatar of Skylar

ASKER

Thank you Roy.
Do you want to copy the first table completely so that the headings are imported?
Avatar of Skylar

ASKER

Thanks Roy.

Yes, I want to copy the first table completely so that the headings are imported
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Skylar

ASKER

Thanks Roy
Hi Skylar

Is working as expected now?
Avatar of Skylar

ASKER

this latest code throws error

User generated image
and i tried now with the original code https://www.experts-exchange.com/questions/29129095/How-to-Merge-all-Excel-Tables-into-a-single-Table.html?anchorAnswerId=42753688#a42753688   this one also throws error stating that file does not exist while in fact the file does exist.
Can you attach the workbook
Avatar of Skylar

ASKER

I have attached both codes with its sample data.

the original file with its sample data

https://www.dropbox.com/s/tuvm61lqak2t9l3/Original%20Macro%20with%20its%20samplefiles.zip?dl=0



the latest code with its sample data
https://www.dropbox.com/s/wmqpz9gzt9xcni6/Modified%20Macro%20include%20header.zip?dl=0
I'll go through them later
Avatar of Skylar

ASKER

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Skylar

ASKER

Roy,

Thank you so very much!  it worked.
Pleased to help.