string sorting problem

N

NikkoW

I have four workbooks, each containing a list of customer names and the
number of products they have ordered from us. I can't combine the lists into
one because there are too many entries. A given customer's name could appear
in more than one of the workbooks.

I need to combine all entries, across all four books, for one customer at a
time, and write that name once and the sum of all products they ordered into
a fifth workbook.

I have sorted each workbook by name and written most of the code for the
project. What I am missing:

How do I compare strings to sort alphabetically?
 
T

Tom Ogilvy

Use the sumif function

tot = 0
for i = 1 to 4
tot = tot + application.Sumif( _
workbooks(1).Worksheets(1).Range("A:A"), customer_name, _
workbooks(1).Worksheets(1).Range("B:B")
Next
 
Top