Get the data from excel files in sub directories

后端 未结 2 1277
予麋鹿
予麋鹿 2021-01-15 21:25

I am new to VBA and to programming in general. This is my first post on this board. I\'ve been working on this for a while modifying code I\'ve found on the internet and I h

2条回答
  •  旧时难觅i
    2021-01-15 21:55

    Thank you to both of you!! A simple Bing-search led me to this valuable collection of code, which I was able to adapt and apply within a few minutes. Excellent work!

    Any other beginner (as myself) wanting to use this code, note the following necessary changes:

    ProcessFiles FolderName, "*.xls"
    

    should be changed to "*.xlsx" for excel2010 files.

    In the line:

    cValue = GetInfoFromClosedFile(wbList(i), "Quality Rep.", "c9")
    

    and below the similar lines, the "Quality Rep." should be changed to the sheet names where you want to get data from. In the line:

        Sheets("Sheet1").Cells(r, 1).Value = cValue
    

    and below the "Sheet1" should be changed to the sheet name where you want to put the data.

    Apart from that, no changes should be necessary.

提交回复
热议问题