Auto look through subfolders

  • Thread starter Thread starter grewpp
  • Start date Start date
G

grewpp

Please help.

I can write a macro that will extract data from all excel files in a
specific folder.

What I need to be able to do is write a macro that will automatically
extract data from excel files within folders and sub folders and sub
sub folders etc

For example the data is all held on the following directory:

H:\development forms\2006 cost sheets\

And within that directory by customer - for example Tesco, Boots, Asda
etc. These customers are then subdivided into product ranges - eg
1,2,3,4 etc and some futher subdivided by national or exclusive. All
the excel files are in exactly the same format. I need to extract the
exact same data from each cost sheet into one workbook.

There are approximately 450 cost sheets at present, which changes on a
daily basis. I have a macro that will look mat all the files within an
individual folder, but as I need to refresh this several times during
the day it does take too long to search through every sub folder.

I should point out that my Macro skills are very limited.

I do hope somebody can help.

Paul Grewer
 
Assuming you have a subroutine that has a parameter of the folder-to-be-
searched...

Whatever method you are using to find the files in the folder has a
complimentary method to identify the sub-folders. Use that to loop through
all the sub-folders calling the same subroutine for each folder.

This recursive algorithm is the easiest to implement.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Back
Top