ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop through a range of cells to find unique entries (https://www.excelbanter.com/excel-programming/360107-loop-through-range-cells-find-unique-entries.html)

zoot

Loop through a range of cells to find unique entries
 
Hello All,
I am trying to loop through a column of cells for all unique entries. I
know how to loop but i don't know how to specify the results of being unique
and adding them to a seperate column can anyone help?

Column A

Test
Test 1
Test 2
Test
Test 1

I want this to appear in column B

Column B
Test
Test 1
Test 2

Thanks everyone



somethinglikeant

Loop through a range of cells to find unique entries
 
Rather than looping I would use the following code:-

Range("A:A").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range("B1" _
), Unique:=True

It uses Advanced Filter to copy unque entries to B1.
Play around with this, I think it is far more straightforward,

Somethinglikeant


zoot

Loop through a range of cells to find unique entries
 
Thank you very much thats great!!!
"somethinglikeant" wrote in message
oups.com...
Rather than looping I would use the following code:-

Range("A:A").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range("B1" _
), Unique:=True

It uses Advanced Filter to copy unque entries to B1.
Play around with this, I think it is far more straightforward,

Somethinglikeant





All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com