Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete identical rows in excel

Status
Not open for further replies.

Jofx

Technical User
Jan 12, 2005
16
FR
Hi,

I'm looking for a Excel VBA code to delete all identical rows in a range (keeping unique rows).
ex:

Col A
A
B
B
C
D
D
D

should give:

Col A
A
C

Any idea ?
Thanks
 
Use the macro recorder to record the following:

add a helper column and enter formula

=countif(A1:A100,A1)

copy formula down to bottom of dataset

add autofilter

custom criteria of > 1

delete ALL rows

remove autofilter

et voila....

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Just a minor addition to the above
It may help to make the test range absolute before copying the formula xlbo has given you, ie countif(A$1:A$100,A1).

Also, this link might be of some interest to you

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
thx Loomah - nice catch

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thanks Geoff and Loomah
I've have to try it now.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top