PDA

View Full Version : Combine Excel sheets w/ same name into one



Jmrogue21
04-04-2019, 08:16 AM
Hello,

I am having a bit of trouble trying to find a way to do this, so I am trying to post here. I have several excel files that I want to combine into one, I already have one that will do this for me but I am looking for something a little different. Here is what I want. I want to have a script that will be able to look in all the excel files in the folder. Then, look for the same tabs in each file. Then it will copy all those tabs or "sheets" into one.

For example:
tabs on File 1: Aged, completed, outbound
tabs on File 2: Aged, completed, outbound
tabs on File 3: Aged, completed, outbound, other

Here it will take the data from all the "Aged" tabs, and put them into one under a tab called "Aged". Next, it will take all the "completed" tabs and put them under a tab called completed. and so on.... I also want it to move over the "other" tab, even though it does not match any of the other files.

Here is my dilemma, I have one right now that will put them into one workbook but puts them as Aged, Aged (1), Aged (2) and so on. I need them all in one tab for the same information. Also, the tabs can be different at times and not always the same. For example, I might have files with tabs called: "Additional info" and "needs review" so I would need a code to move over all tabs but keep all the tabs with the same name into one.. Also would like to add that if the tabs with the same name are combined, it would not need to copy over row 1 (the header) on all of them, just the first one. So file 1: copy row 1, file 2: copy from row 2.

I know this sounds complicated but any help would be must be appreciated!