Making a sub run in a particular folder

B

Bishop

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.
 
R

ryguy7272

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---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top