Need to add a column in 90 workbooks which has the filename in every row

  • I have a folder of 90 excel files each named according to the date of the data within and where the single worksheet in each file has the exact same name. I need to combine the worksheets into a single worksheet, which I can easily do, but I need to differentiate among the data from the various sheets


    Workbook1 named 12-2015.xlsx
    Worksheet named Detail


    Cust_ID Net_Sales
    1023 $80
    1027 $150


    Workook2 named 01-2016.xlsx
    Worksheet named Detail


    Cust_ID Net_Sales
    1023 $100
    1027 $175


    I need all the data combined on one sheet along with the date of the date (the Workbook name)

  • Re: Need to add a column in 90 workbooks which has the filename in every row


    You may try something like this......
    Click the button on the sheet to run the code.


  • Re: Need to add a column in 90 workbooks which has the filename in every row


    [QUOTE=sktneer;774722]You may try something like this......
    Click the button on the sheet to run the code.


    I'm not sure what button I was supposed to click on, but I just pasted the code into a new module in ThisWorkbook, and then ran the macro. It worked perfectly. Thank you, this is brilliant and I am sure that there are many others looking for something like this.


    Thanks again,

  • Re: Need to add a column in 90 workbooks which has the filename in every row


    You're welcome. Glad I could help.


    The button I was referring to was placed on Sheet1 in the attached and named Combine Files. :)

    Regards.
    sktneer

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!