![]() |
Write Unique Values to New Worksheet
I have a worksheet that contains two columns of data, I need a macro that
will write unique values from the source worksheet to an existing worksheet. The value is only considered to be unique if the combination of the two values does not already exist in the target worksheet. The macro should run each time the worksheet is opened. Any help is much appreciated. Regards, John |
Write Unique Values to New Worksheet
You could load the concatenation of each pair of the existing values into a
collection, then go through the new data, and try to add the concatenated values to the collection. If you get an error, that row already exists. If not, then copy the data to the bottom of an existing sheet. You can see an example of using a collection to get a unique list at John Walkenbach's site. http://www.j-walk.com/ss/excel/tips/tip47.htm You should be able to adapt that to your situation. -- Regards, Tom Ogilvy "John_Carty" wrote in message ... I have a worksheet that contains two columns of data, I need a macro that will write unique values from the source worksheet to an existing worksheet. The value is only considered to be unique if the combination of the two values does not already exist in the target worksheet. The macro should run each time the worksheet is opened. Any help is much appreciated. Regards, John |
All times are GMT +1. The time now is 05:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com