+ Reply to Thread
Results 1 to 7 of 7

VBA for listing Products in All Excel Files in Folder

  1. #1
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    VBA for listing Products in All Excel Files in Folder

    Hi Excel Gurus.
    In my new job encountered with a challenge. The solution of my problem will save my time. However I am pretty good at excel functions but I am sure that this problem cannot be solved with functions. Thus asking for your help. Appreciate all kind of suggestions and help.

    My partners archived more than 1000 excel files in one folder and each of these folders contains Product names with its prices. All these products start at cell F7 and its numbers changes. Some of them only one and some more than 15. They are in the same row. F7-G7-H7 etc.

    Yesterday I was able to find VBA code to list only file names in folder. But Its not enough unfortunately. I attach the file with the Folder picture. In "My VBA" sheet there is macro that I found. But for me the most important is "Improved Ver." sheet. And there I simulated the desired result. In one column I want to list products and there file names in front of them.

    In my real data there more than 1000 excel files (all of them in 2003 vers.) and each of them contains 1 to 20 (or more) products. In the end there will be about 10000 row listed. I use Excel 2007.

    Thank you in advance
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA for listing Products in All Excel Files in Folder

    This might work

    Please Login or Register  to view this content.
    If assumes that you will start the macro running with the 'My VBA' tab activated. You will need to change the path to the actual one where your files sit.

    I haven't tested the code as I haven't got the the files to test it with so I've made some assumptions that the remainder of row 7 is empty.
    Martin

  3. #3
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: VBA for listing Products in All Excel Files in Folder

    Hi mrice
    Thank you for quick reply.
    But I couldnt make it work. Is it possible to select folder with FileDialog(msoFileDialogFolderPicker) method.
    I replaced real path with "C:\temp\" but got no result.

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA for listing Products in All Excel Files in Folder

    OK, try this.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: VBA for listing Products in All Excel Files in Folder

    Yesterday I couldnt make it work. After a closer look to your codes I noticed that:
    ThisWorkbook.Sheets(1).Cells(X, 6) = ThisWorkbook.Sheets(1).Cells(N, 1) in this row there should be letter "M" instead of "N".
    After that correction macro started to work. It list all products name but it doesnt list its file names. I add the file.

    Thank you again
    Attached Files Attached Files

  6. #6
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA for listing Products in All Excel Files in Folder

    Try this replacement

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-02-2012
    Location
    Baku
    MS-Off Ver
    Excel 2010
    Posts
    273

    Re: VBA for listing Products in All Excel Files in Folder

    Its wonderful. Thank you very much. It works perfectly.
    Now I have to test it in work. Hope it will work there, too.

    Thank you again. Good luck

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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