![]() |
Making a sub run in a particular folder
Say I have the following path to a folder "Centers": X:\...\...\...\Centers Within the Centers folder I have 10 folders, each named a particular city: X:\...\...\...\Centers\LA X:\...\...\...\Centers\NY X:\...\...\...\Centers\San Diego etc In each of the city folders are Weekly Excel reports. I'm writing a program that will look in each city folder and pull out only a specified month. I don't know how to tell the code to go to each of the city folders and execute. How do write that? This is what I'm trying to do explained a different way: I have a spreadsheet with a dropdown and a button, "Compile". I select "March" from my dropdown and click Compile. My code should go to X:\...\...\...\Centers\LA, pull out all spreadsheets with "March" in the filename, execute whatever code I specify, and dump it into another sheet in the workbook called LA. Once LA is done the code should continue to the next city folder and do the same thing until the code runs through all the city folders. |
Making a sub run in a particular folder
You want a batch processing macro. look at this example: http://www.rondebruin.nl/copy4.htm Go to the section named 'Change cells or range in one or all worksheets in each file'. Replace the red code with code that does what you need done. Post back if you have any additional questions. HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Bishop" wrote: Say I have the following path to a folder "Centers": X:\...\...\...\Centers Within the Centers folder I have 10 folders, each named a particular city: X:\...\...\...\Centers\LA X:\...\...\...\Centers\NY X:\...\...\...\Centers\San Diego etc In each of the city folders are Weekly Excel reports. I'm writing a program that will look in each city folder and pull out only a specified month. I don't know how to tell the code to go to each of the city folders and execute. How do write that? This is what I'm trying to do explained a different way: I have a spreadsheet with a dropdown and a button, "Compile". I select "March" from my dropdown and click Compile. My code should go to X:\...\...\...\Centers\LA, pull out all spreadsheets with "March" in the filename, execute whatever code I specify, and dump it into another sheet in the workbook called LA. Once LA is done the code should continue to the next city folder and do the same thing until the code runs through all the city folders. |
All times are GMT +1. The time now is 02:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com