Link to home
Start Free TrialLog in
Avatar of ksarafi1
ksarafi1

asked on

How to compare two arrays and write the uniue elements of one on a third array on VBA

The attached workbook contains two lists of customers:last year purchasers company last and this year purchasers

I want to write a sub that captures the existing lists in two arrays and then creates three new arrays:

1) One with customers who purchased last year only
2) One with customers who purchased this year only    
3) One with customers who purchased in both years.

After these new arrays have been filled, need to write their contents in columns D, E and F of the worksheet.
CustomerLists.xls
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ksarafi1,

How did this work for you?  

It has been three days since your last interaction with this discussion thread.  Please remain an active participant with your open questions.
Avatar of ksarafi1
ksarafi1

ASKER

Thank you very much for your help. You solution was accurate and efficient.
@ksarafi1,

Glad I could help.

If you run this when either of the three lists shrinks, you might find some cells populated from the prior run.  To prevent this, add the following statement after the
    Application.ScreenUpdating = False
line:

Range("D4:F65536").Clear 

Open in new window