Solved

Quick way to remove duplicates with VBA

Posted on 2014-01-21
5
563 Views
Last Modified: 2014-01-21
I have trolled through EE and various other sites to find a definitive way to remove duplicates with VBA code but they all seem to take forever to complete, reason being that my spreadsheet has over 200000 rows.

Can any expert provide me with VBA code that will quickly remove duplicates from column A in my spreadsheet.

Thanks
0
Comment
Question by:Jagwarman
  • 3
  • 2
5 Comments
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 39796447
Hi,

pls try Data / data Tools / Remove Duplicates and select the column you want

or like this

ActiveSheet.Range("$A$1:$B$7").RemoveDuplicates Columns:=1, Header:=xlNo

Open in new window



Regards
0
 

Author Comment

by:Jagwarman
ID: 39796557
It's not until I get a reply sometines that I realize I should have been more specific.

I need to find the duplicates in column A but remove the entire Row.

Sorry.
0
 

Author Comment

by:Jagwarman
ID: 39796560
Rgonzo1971 did you see my post to you Re:

search for text in a file in a folder from an open file
0
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39796562
HI,

pls try
    ActiveSheet.Range(Range("A1"), Cells(Range("A" & Cells.Rows.Count).End(xlUp).Row, Cells(1, Cells.Columns.Count).End(xlToLeft).Column)).RemoveDuplicates Columns:=1, Header:=xlNo

Open in new window

Regards
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 39796588
Hi,

For the other question, could you open a new question

Regards
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question