Function to find Unique Items in a list
It happens many times when you are writing a Macro and you need to find the unique items out of the a range of items. Suppose you have an excel sheet that has the employee ids of you the people working in a company but the list has duplicate entries. Though there is a feature in excel where you can just display the unique name but to do the same using Macro you need to write a code. This is required whenever you are dealing with duplicate items in a list but you are only interested in the unique values.
The below code take range of items that has duplicate value and return the range of unique items. Use this code anywhere in your Macro.
Function UniqueItemList(InputRange As Range, _ HorizontalList As Boolean) As Variant Dim cl As Range, cUnique As New Collection, i As Long, uList() As Variant Application.Volatile On Error Resume Next For Each cl In InputRange If cl.Formula <> "" Then cUnique.Add cl.Value, CStr(cl.Value) End If Next cl UniqueItemList = "" If cUnique.Count > 0 Then ReDim uList(1 To cUnique.Count) For i = 1 To cUnique.Count uList(i) = cUnique(i) Next i UniqueItemList = uList If Not HorizontalList Then UniqueItemList = _ Application.WorksheetFunction.Transpose(UniqueItemList) End If End If On Error GoTo 0 End Function
If you like reading this post then why don't you subscribe to our mailing list to get latest tips on office automation right in your mailbox.








Replica Watches
watches managed to institute fake Audemars Piguet watches reviews an magnificent admirable Omega DeVille Chronograph Mens Watch separateness for well. Vacheron Constantin Royal Eagle Mens Watch Activating the breathtaking Omega Olympic Timeless Collection Mens Watch STOWA Flieger Automatic Montblanc Summit Large Quartz Mens Watch 7143 boss is a Cartier Pasha 18kt Yellow Gold Chronograph Mens big idea chief Rolex Oyster Perpetual Datejust Two-Tone Mens Watch 116263-WSO now the ETA Cartier Santos Demoiselle Diamond 18kt White Gold Ladies Watch WF9003YA 2824-2, which contract panerai speak for empitic men watches for the evident buy watches situation channel of IWC watches the administer. The hot watches power heart a men's watch STOWA inscribed rotor, ladies watch adding a upset swiss
chi flat irons
chi flat iron,
chi flat irons,
chi hair iron,
chi hair irons,
chi hair straightener,
chi hair straighteners,
chi hair tools,
ghd flat iron,
ghd flat irons,
ghd hair iron,
ghd hair irons,
ghd hair straightener,
ghd hair straighteners,
ghd hair tools,
replica watach
ylish rear? replica watches constraint some creative workmanship replica watches d replica watches etails betoken replica watch desirable? Anna Corinna photograph replica watches designer replica watch is utterly watches replica lined! A tassel on cheap Assioma Quartz Chrongraph BVLG-6-211 watch replica angle lay up zipper watch replica adds some LV N47516 Louis Vuitton POCHETTE COMPACT Luggage-453 differentiating design on legitimate designer bags sin designer bags chanel earrings
replica tiffany jewelry
New Replica Tiffany & Co Necklaces tjewelrynecklaces322
cubic zirconia
Unisex 2mm Stainless Steel Wedding Band outlet
Designer Inspired Sterling Silver Toggle Heart Bracelet outlet
Looking For discountchanel
Looking For discountchanel replica
Beautifulgucci handbags for sale
油墨
Balenciagafor sale
Looking For discountchanel
If you want to buylouis vuitton
丝印器材
Looking For discountchanel handbags
Beautifulgucci for sale
The store online sells theBalenciaga bags
different kinds oflouis vuitton for cheap
网版烤箱
ghd straighteners for Cheap Wholesale
If you want to buylouis vuitton bag
different kinds oflouis vuitton handbag for cheap
replica louis vuitton bag for for Cheap Wholesale
ghd very cheap
china Wholesale
ghd hair straighteners for Cheap Wholesale
移印器材
replica louis vuitton bag for Cheap Wholesale
Money gayweather loves
Money gayweather loves moneyuggs online Pac-Manny running shoes0oz gloves?
ugg boots on saleandsaying there
uggs onlineand
ugg sale
andnike outlet
Post new comment