Removing duplicates in collection

When Microsoft is publishing new version of Excel they add new tools to Excel. I think in newest version of Excel there is duplicates remover. In Excel 2003 there wasn’t such a tool – I think there wasn’t? Few years ago writing application to support automatic warehouse there was need to extract unique batch numbers.

I don’t remember from where code has been taken – but I think it has been copied from some book of John Walkenbach. Following code is removing column’s values duplicates by adding them to new collection. To prevent error showing On Error Resume Next must be added to code. It’s known that used loop means long waiting time when there is a lot of not empty cells in column.

Removing duplicates:

Private Sub AddNextSheets()

Dim LicznikWierszy As Long
Dim RemoveDuplicates As New Collection
Dim NewFileName as string

NewFileName "Some Excel file name"

LicznikWierszy = 10
Do Until ThisWorkbook.Sheets("SheetName").Cells(LicznikWierszy, 6) = ""

    If ThisWorkbook.Sheets("SheetName").Cells(LicznikWierszy, 6) <> "" Then
        ' When cell is not empty then is adding to collection
        On Error Resume Next
        ' Removing duplicates
        RemoveDuplicates.Add ThisWorkbook.Sheets("SheetName").Cells(LicznikWierszy, 6), _
        CStr(ThisWorkbook.Sheets("SheetName").Cells(LicznikWierszy, 6))
        On Error GoTo 0
        ' Empty cell - nothing happened
    End If
LicznikWierszy = LicznikWierszy + 1

' Adding new sheets to chosen file with name from RemoveDuplicates collection
Dim Item As Object
For Each Item In RemoveDuplicates
    ' Adding sheet at end of WorkSheet
    Sheets.Add After:=Workbooks(NewFileName).Sheets(Workbooks(NewFileName).Sheets.Count)
    ' Name change
    Workbooks(NewFileName).Sheets(Workbooks(NewFileName).Sheets.Count).Name = Item & "-AA"

310 thoughts on “Removing duplicates in collection

  1. Pingback: 토토도메인

  2. Pingback: 파워볼이브

  3. Pingback: buy/order hydrocodone online pharmacy legally cheap no script for pain, anxiety from USA UK Canada Australia Europe overseas overnight delivery

  4. Pingback: cach soi keo bong da

  5. Pingback: order xanax online in usa canada uk australia without prescription nextday shipping

  6. Pingback: danh de online uy tin

  7. Pingback: mo thay cho danh con gi

  8. Pingback: Pi News Wire

  9. Pingback: thenaturalpenguin

  10. Pingback: keo chap

  11. Pingback: mơ rắn đánh đề con gì

  12. Pingback: English and French bulldog puppies for sale near me in USA Canada Uk Australia Europe cheap

  13. Pingback: UNICC CM

  14. Pingback: fake watches

  15. Pingback: long blonde wig

  16. Pingback: buy/order Orange Creamsicle Creampop marijuana Edibles online use for pain, anxiety, sleep for sale near me bulk in usa uk nz canada australia overnight delivery

  17. Pingback: Hotels near Anaheim Train Station

  18. Pingback: eatverts

  19. Pingback: buy/order percocet 10/325 30mg 15mg online pharmacy legally no script for pain anxiety weight loss in USA Canada UK Australia overseas overnight delivery

  20. Pingback: immediate edge reviews

  21. Pingback: buy rishi turkey tail Magic Mushroom pills Capsules trip drug online for sale near me in USA Canada UK Australia overnight delivery cheap

  22. Pingback: Order Adderall 10mg online overnight delivery

  23. Pingback: Immediate Edge

  24. Pingback: frontier airlines Phone Number

  25. Pingback: Plumber Near Me

  26. Pingback: bitcoin loophole review 2020

  27. Pingback: mơ thấy con mèo đánh con gì

  28. Pingback: mơ thấy ba ba

  29. Pingback: Bichon Frise Puppies

  30. Pingback: mơ thấy người cha đã mất

  31. Pingback: Keltec Firearms for Sale

  32. Pingback:

  33. Pingback: visit website

  34. Pingback: ตู้แปลภาษา

  35. Pingback: mo gap ran

  36. Pingback: nằm mơ thấy nhà sập

  37. Pingback: Rock Island Armory VR80 12ga Shotgun

  38. Pingback: male sex dolls for sale

  39. Pingback: BP-12

  40. Pingback: con cóc số mấy

  41. Pingback: mơ thấy người khác chết đuối

  42. Pingback: mơ thấy gấu

  43. Pingback: nam mo thay ngo

  44. Pingback: mơ câu được cá chép

  45. Pingback: nằm mơ thấy nhà mới

  46. Pingback: centralqq

  47. Pingback: dơi bay vào nhà tốt hay xấu

  48. Pingback: Stiiizy pod

  49. Pingback: buy cialis overnight

  50. Pingback: safe to buy levitra online

  51. Pingback: cialis ordering australia

  52. Pingback: cialis ordering

  53. Pingback: viagra 100mg generic

  54. Pingback: buy cialis philippines

  55. Pingback: find cheap cialis online

  56. Pingback: ordering cialis online australia

  57. Pingback: cost of tadalafil without insurance

  58. Pingback: can i buy cialis in uk

  59. Pingback: cialis 20mg for sale

  60. Pingback: yhoyhpmy

  61. Pingback: where can i buy cheap viagra online

  62. Pingback: hoe gevaarlijk is viagra

  63. Pingback: how long does it take for zithromax to dissolve

  64. Pingback: cheap generic cialis

  65. Pingback: chew or swallow sildenafil

  66. Pingback: buy cialis

  67. Pingback: generic viagra

  68. Pingback: ordering cialis online australia

  69. Pingback: can i buy cialis in toronto

  70. Pingback: viagra

  71. Pingback: buy cialis with paypal

  72. Pingback: college application essay writing service

  73. Pingback: research paper writer

  74. Pingback: write my essay for me online

  75. Pingback: essay on the help

  76. Pingback: power v8 viagra

  77. Pingback: taking cialis soft tabs

  78. Pingback: taking cialis soft tabs

  79. Pingback: where can i buy amoxocillin

  80. Pingback: furosemide 20 mg tablet cost

  81. Pingback: zithromax online purchase

  82. Pingback: ivermectin over the counter canada

  83. Pingback: albuterol 990 mcg

  84. Pingback: doxycycline for abscess

  85. Pingback: prednisolone in pregnancy

  86. Pingback: clomid mood swings

  87. Pingback: order priligy

  88. Pingback: diflucan tablet dosage

  89. Pingback: who manufactures synthroid

  90. Pingback: merck propecia coupons

  91. Pingback: neurontin 200 mg

  92. Pingback: insulin vs metformin

  93. Pingback: paxil tired

  94. Pingback: plaquenil stopping

  95. Pingback: cialis sale 20mg

  96. Pingback: buy cialis online in canada

  97. Pingback: 20 mg cost

  98. Pingback: Husband On Tinder

  99. Pingback: best payday loans denver

  100. Pingback: free malta dating sites

  101. Pingback: best tadalafil tablets

  102. Pingback: viagra

  103. Pingback: cialis on ebay

  104. Pingback: sildenafil 100mg cost

  105. Pingback: define cialis

  106. Pingback: viagra overnight

  107. Pingback: tadalafil natural substitute

  108. Pingback: online viagra

  109. Pingback: price of tadalafil

  110. Pingback: sildenafil 100mg gel

  111. Pingback: diclofenac injection

  112. Pingback: plaquenil hydroxychloroquine stock market

  113. Pingback: viagra overdose

  114. Pingback: will hydroxychloroquine kill tapeworms

  115. Pingback: hydroxychloroquine treatment update

  116. Pingback: hydroxychloroquine stock markets price

  117. Pingback: keto coffee creamer

  118. Pingback: ivermectil antibiotic uses

  119. Pingback: ivermectin indications

  120. Pingback: priligy tablets price

  121. Pingback: stromectola trihydrate capsule uses

  122. Pingback: stromectol clav 875

  123. Pingback: deltasone and rayos tablets

  124. Pingback: gay oz dating sites

  125. Pingback: stromectol treats

  126. Pingback: ivermectin products

  127. Pingback: ivermectin and rosacea

  128. Pingback: coffee and stromectol

  129. Pingback: generic amoxil

  130. Pingback: lasix 10

  131. Pingback: gabapentin 800 mg

  132. Pingback: plaquenil online

  133. Pingback: deltasone 50 mg cost

  134. Pingback: super avanaful

  135. Pingback: modafinil cost

  136. Pingback: stromectol tablets uk

  137. Pingback: generic viagra over counter

  138. Pingback: albuterol 180 mcg

  139. Pingback: azithromycin treats

  140. Pingback: price of lasix 80 mg

  141. Pingback: buy neurontin 100 mg

  142. Pingback: 2.5 mg prednisone

  143. Pingback: provigil how to buy

  144. Pingback: stromectol for sale

  145. Pingback: cialis 40mg india

  146. Pingback: women taking viagra

  147. Pingback: ivermectin 3mg for lice

  148. Pingback: aralen 100mg

  149. Pingback: latisse near me

  150. Pingback: mulnupiravir

  151. Pingback: 10 zanaflex

  152. Pingback: clomid discount

  153. Pingback: baricitinib 4 mg

  154. Pingback: Anonymous

  155. Pingback: tamoxifen sale

  156. Pingback: Anonymous

  157. Pingback: is ivermectin safe for humans

  158. Pingback: ivermectin kaufen

  159. Pingback: stromectol walgreens

  160. Pingback: ignition casino legit

  161. Pingback: ivermectin cost

  162. Pingback: buy generic prednisone 10mg

  163. Pingback: tadalafil dosages

  164. Pingback: buying tadalafil

  165. Pingback: topical ivermectin cost

  166. Pingback: how much does ivermectin cost

  167. Pingback: safe place order viagra online

  168. Pingback: tadalafil citrate

  169. Pingback: sildenafil uses

  170. Pingback: can you get ivermectin over the counter

  171. Pingback: buy generic cialis daily

  172. Pingback: tadalafila

  173. Pingback: cialis cialis online

  174. Pingback: sildenafil tablets for sale

  175. Pingback: tadalafil sandoz

  176. Pingback: buy ivermectin pills

  177. Pingback: sildenafil citrate

  178. Pingback: sildenafil pills for men

  179. Pingback: generic

  180. Pingback: cialis no prescription

  181. Pingback: prednisone 20mg vidal

  182. Pingback: buy prednisone 5 mg

  183. Pingback: medicine for coronavirus

  184. Pingback: kamagra vs cialis

  185. Pingback: tadalafil sandoz

  186. Pingback: stromectol 3 mg tablets price

  187. Pingback: where to purchase sildenafil

  188. Pingback: cialis dosis

  189. Pingback: live casinos online deals indian best casino

  190. Pingback: how to get cheap viagra online

  191. Pingback: borgata online casino

  192. Pingback: molnupiravir and ivermectin

  193. Pingback: cialis price walmart

  194. Pingback: ivermectin cream

  195. Pingback: online casinos for real money

  196. Pingback: generic viagra buy

  197. Pingback: 20mg cialis online tadalafil

  198. Pingback: what is cialis

  199. Pingback: buy cephalexin

  200. Pingback: ivermectin generic

  201. Pingback: where to buy ivermectin pills

  202. Pingback: ivermectin for sale

  203. Pingback: ivermectin cream 5%

  204. Pingback: cost of ivermectin medicine

  205. Pingback: stromectol 5 mg

  206. Pingback: keflex bactericidal

  207. Pingback: get ivermectin

  208. Pingback: azithromycin classification

  209. Pingback: buy ivermectin 12mg otc

  210. Pingback: imverctin

  211. Pingback: erythromycin oint

  212. Pingback: keflex antibiotico

  213. Pingback: buy ivermectin pills

  214. Pingback: ivermectin 3mg price

  215. Pingback: ivermectin 12 mg

  216. Pingback: cdc ivermectin

  217. Pingback: buy generic lasix

  218. Pingback: furosemide 40 mg tablets online

  219. Pingback: buy ivermectin 12mg

  220. Pingback: stromectol for head lice

  221. Pingback: ivermectin manufacturers

  222. Pingback: ivermectin cream 1%

  223. Pingback: price of ivermectin tablets

  224. Pingback: ivermectin 12mg otc

  225. Pingback: stromectol 12mg online

  226. Pingback: luckyland slots casino sign in

  227. Pingback: cialis otc

  228. Pingback: buy stromectol uk

  229. Pingback: top rated online canadian pharmacies

  230. Pingback: canada pharmacy

  231. Pingback:

  232. Pingback: ivermectin 4 tablets price

  233. Pingback: graph.orgOmicron-Variant-Symptoms-Is-An-Excessive-Amount-Of-Mucus-A-COVID-19-Symptom-02-24

  234. Pingback: ivermectin ebay

  235. Pingback:

  236. Pingback:

  237. Pingback: canada pharmacy online

  238. Pingback: ivermectin 0.5% lotion

  239. Pingback: viagra canada

  240. Pingback: chubo3.wixsite.comcanadian-pharmacypostwhat-parents-must-find-out-about-kids-and-covid-19

  241. Pingback: canadian pharmacies mail order

  242. Pingback:

  243. Pingback:

  244. Pingback: cialis over the counter walmart

  245. Pingback:

  246. Pingback: seketu.gonevis.comhigh-10-tips-with-order-medicine-online-1

  247. Pingback: Canadian Pharmacies Shipping to USA

  248. Pingback: canadian pharmacycanadian pharmacy

  249. Pingback: hernswe.gonevis.comscientists-model-true-prevalence-of-covid-19-throughout-pandemic

  250. Pingback:

  251. Pingback: where can you buy ivermectin

  252. Pingback: ivermectin in diabetic patients

  253. Pingback: ivermectin price

  254. Pingback:

  255. Pingback:

  256. Pingback: sasnd0.wixsite.comcialispostimpotent-victims-can-now-cheer-up-try-generic-tadalafil-men-health

  257. Pingback: buy tadalafil no prescription

  258. Pingback: stromectol kaufen

  259. Pingback: pharmacy walmart

  260. Pingback:

  261. Pingback: buy cialis us pharmacy

  262. Pingback:

  263. Pingback: buy cialis online without a prescription

  264. Pingback:

  265. Pingback:

  266. Pingback:

  267. Pingback: cialis canadian pharmacy

  268. Pingback: canadian pharcharmy online

  269. Pingback:

  270. Pingback: canadian pharmacies that are legit

  271. Pingback: canadian pharmacies that ship to us

  272. Pingback: canadianpharmacy

  273. Pingback: canadian rx

  274. Pingback: best canadian pharmacies online

  275. Pingback:

  276. Pingback:

  277. Pingback: canadian online pharmacies

  278. Pingback: safe canadian online pharmacies

  279. Pingback: canada drugs online

  280. Pingback: canadian pharmacy uk delivery

  281. Pingback:

  282. Pingback: intermectine

  283. Pingback: buy viagra now

  284. Pingback:

  285. Pingback:

  286. Pingback: hydroxychloroquine 200 mg

  287. Pingback:

  288. Pingback: sekyuna.gonevis.comthree-step-guidelines-for-online-pharmacies

  289. Pingback:

  290. Pingback:

  291. Pingback:

  292. Pingback:

  293. Pingback:

  294. Pingback: buy viagra usa

  295. Pingback:

  296. Pingback: canadian prescriptions online

  297. Pingback: canadian pharmaceuticals

  298. Pingback:

  299. Pingback:

  300. Pingback: lwerts.livejournal.com276.html

  301. Pingback:

  302. Pingback:

  303. Pingback:

  304. Pingback: drugs for sale

  305. Pingback:

  306. Pingback:

  307. Pingback: canada pharmacies online prescriptions

  308. Pingback:

  309. Pingback:

  310. Pingback: asebg.bigcartel.comcanadian-pharmacy

Leave a Reply

Your email address will not be published.