How to traverse files (conditionally) faster than using FileSystemObject

后端 未结 4 2021
走了就别回头了
走了就别回头了 2021-01-07 11:50

I\'ve written some VBA code using file objects to go into a folder, search for particular files (CSV) that meet certain criteria (contain \"HR\" in filename and created with

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-07 12:39

    Take a look at Power Query -- it's a Microsoft add-in for Excel versions 2012 & 2013, and built-in to 2016. Setting up PQ to do this will be amazingly fast, and the 'script' is reusable! No VBA needed.

    You can search and combine the multiple files on the specified criteria, but then merge or append to the new/master file, too. For efficiency, rather than processing each file individually, might I suggest gathering up all the data files (by your criteria), combining them to one table, then use the new table to merge/append to the new/master

    Hope this helps...

提交回复
热议问题