For....each w/ workbook files

G

Guest

I have daily production workbooks that I need to combine into a monthly total
workbook. They each have the same layout/format etc. I just need to step
through each workbook in a directory and add the numbers to the monthly total
workbook. Is it possible to use a for...each loop? If so, what is the
correct syntax?

eg...

dim wkb as workbook
for each wkb in <Path>
wkb.open
'add numbers to ThisWorkbook
wkb.close
next wkb

where <Path> is the same directory as ThisWorkbook (which contains the code)
 
G

Guest

Thanks Ron. Your code is a little over my head, but it seems to require
either hard-coding the file names or getting user input (via
GetOpenFileName). Is there not a way to open all the files in a directory
(either one at a time or at the same time)?
 

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