Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default For....each w/ workbook files

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)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default For....each w/ workbook files

Hi Marcotte

I have examples on my webpage
http://www.rondebruin.nl/tips.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Marcotte A" wrote in message
...
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)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default For....each w/ workbook files

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)?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default For....each w/ workbook files

Sure
http://www.rondebruin.nl/copy4.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Marcotte A" wrote in message
...
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)?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default For....each w/ workbook files

TYVM. God Bless MVPs. :)

"Ron de Bruin" wrote:

Sure
http://www.rondebruin.nl/copy4.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Marcotte A" wrote in message
...
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)?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Several files open from workbook, how to do that? artzuka Excel Discussion (Misc queries) 3 January 6th 09 09:03 PM
Combining files to one workbook toneman Excel Discussion (Misc queries) 1 March 20th 07 08:21 PM
one workbook, multiple .xls files Marcia Excel Discussion (Misc queries) 1 July 11th 06 09:50 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
merging different workbook files MrD Excel Worksheet Functions 0 August 4th 05 08:25 AM


All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"