View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 153
Default Copying data from many files

Hello,

Using Excel XP.

I have a number of files in one directory (say C:\Temp).
Each file has two sheets - "Infor" and "Sales". The
layout and format of "Sales" is the same in all files.
Example for 2 files follows.

Cell C1 of the "Info" sheet in each workbook contains the
customers name (= the name of each workbook respectively)

(b) = blank cell

ABC.xls - Sales worksheet (A1: C downwards)
ItemCode ItemDesc Type1$ Type2$
101 Item114 $101 (b)
102 Item102 $50 (b)
203 Item203 (b) $75
204 Item204 (b) $35


XYZ.xls - Sales worksheet (A1: C downwards)

ItemCode ItemDesc Type1$ Type2$
114 Item114 $23 (b)
102 Item102 $50 (b)
103 Item103 $56 (b)
203 Item203 (b) $75
204 Item204 (b) $35
205 Item205 (b) $45

From each file, I need to copy the data from each "Sales"
worksheet to Sheet1 in "Summary_Sales.xls", in the
following format:

CustName ItemCode ItemDesc Type1$ Type2$
ABC 101 Item114 $101 (b)
ABC 102 Item102 $50 (b)
ABC 203 Item203 (b) $75
ABC 204 Item204 (b) $35
XYZ 114 Item114 $23 (b)
XYZ 102 Item102 $50 (b)
XYZ 103 Item103 $56 (b)
XYZ 203 Item203 (b) $75
XYZ 204 Item204 (b) $35
XYZ 205 Item205 (b) $45

I am familiar with FileSearch to open/close each file in
a directory, but I'm failing on the looping syntax to
populate "Summary_Sales.xls". I have unsuccessfully tried
to adapt the syntax from a macro authored Mr. T. Ogilvy
found at http://makeashorterlink.com/?A14813CA8.

I will appreciate any assistance on this matter.

TIA

Richard