I have a range named MyItems.
I want have a macro to list the unique items in MyItems in a message box.
Please advise.
Thanks
I have a range named MyItems.
I want have a macro to list the unique items in MyItems in a message box.
Please advise.
Thanks
This is simplicity itself.
This is the classic description of the difference between a collection and an array.
The process is:-
Read your range into an Array if it is a list it is probably a single array
create a new collection
read each member of your array into the collection.
The collection requires an address and an entry
if you use the entry as its address then each duplicate entry will overwrite its predecessor.
Now read the collection into a new array and save back to excel.
In your case, read every entry of your collection into a text variable
Display the text variable using a message box.
Sounds Long Winded but the bulk of the work has been done for you.
Please Login or Register to view this content.
Last edited by mehmetcik; 10-03-2014 at 09:30 PM.
If your MyItems is a named range on a worksheet (code easily modified if otherwise) you could also tryPlease Login or Register to view this content.
You can also try this...
Getting Uniques
Function syntax is UniqueCol(Range_Arr)
Regards,Please Login or Register to view this content.
Last edited by Vikas_Gautam; 10-03-2014 at 11:32 PM.
Regards,
Vikas Gautam
Excel-buzz.blogspot.com
Excel is not a matter of Experience, its a matter of Application.
Say Thanks, Click * Add Reputation
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks