PDA

View Full Version : [SOLVED] Need help modifying VBA code to suit requirements - Listing Uniques based on criteria



ashleyuk1984
03-29-2017, 05:32 AM
Hi,
I've managed to find a pretty good piece of code that takes a list of multiple values (some the same) and creates a unique list from it.

This is good, and it perfectly suits my requirements on one of my sheets, however, I need to change it slightly to suit my requirements in a different workbook.

At the moment it just takes one list, filters out the unique and sorts it out into alphanumerical order.
But with my 2nd workbook, I need it to do the same, but this time... only list the unique depending on the value in another column.

I've provided an example workbook with some data which hopefully will be easy to understand.

I've tried a couple of things such as adding rng.offset(0,1) but I'm getting "type mismatch" errors... and I think the reason is because I'm not listing the offset column in an array? I'm not sure though.

Thanks

mdmackillop
03-29-2017, 06:22 AM
For Each Value In rng
If Len(Value) > 0 And Value.Offset(, 1) <> "" Then ucoll.Add Value, CStr(Value)
Next Value

ashleyuk1984
03-29-2017, 11:52 AM
ahhhhh, I was so close. I was sure it was going to be something simple like that.

Thanks mdmackillop!!