+ Reply to Thread
Results 1 to 5 of 5

Removing Duplicates VBA Not Optimized

  1. #1
    Registered User
    Join Date
    07-21-2021
    Location
    United States
    MS-Off Ver
    365
    Posts
    1

    Removing Duplicates VBA Not Optimized

    Hello, new to Macros here. I have a simple spreadsheet of contacts with column headers such as name, email, company, etc.

    I am trying to write a simple script that will look for duplicate email addresses (which are in column 3) and delete one of the duplicate rows. My code seems to work, but I need to run it like 5x to fully clean the list for some reason. It should be able to remove all duplicates in one run. Any help is greatly appreciated.
    Please Login or Register  to view this content.
    Last edited by alansidman; 07-22-2021 at 07:23 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Removing Duplicates VBA Not Optimized

    You have to remove rows from bottom to top. You can also remove duplicates like this

    Please Login or Register  to view this content.
    Only works if the data starts in A1 and the email address is in column C. Otherwise just post the file.
    Messages have been translated from Dutch to English by means of google translate.

  3. #3
    Forum Contributor
    Join Date
    01-02-2020
    Location
    Idaho, USA
    MS-Off Ver
    365
    Posts
    269

    Re: Removing Duplicates VBA Not Optimized

    Hello Superchew,

    You can do it with 1 line of code. Change the range and columns to suit:

    Please Login or Register  to view this content.
    Columns is the column to check for duplicates within your range.

    Hope this helps!

    Moderator Edit: Please remember to use Code Tags. I have added them today.
    Last edited by alansidman; 07-22-2021 at 07:25 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Removing Duplicates VBA Not Optimized

    @achammar, See #2 and the email addresses are in column C (3)

  5. #5
    Administrator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 365 Win 11 Home 64 Bit
    Posts
    21,682

    Re: Removing Duplicates VBA Not Optimized

    @superechew

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Remove duplicates not removing duplicates bug, so what???!!!
    By abdelrazzaq in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-19-2016, 01:43 PM
  2. [SOLVED] removing duplicates only within duplicates on another column
    By eculver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2016, 08:08 PM
  3. Remove duplicates function not removing duplicates
    By Berilium2 in forum Excel General
    Replies: 3
    Last Post: 04-01-2015, 06:55 AM
  4. Replies: 6
    Last Post: 03-29-2012, 12:16 AM
  5. Removing Duplicates
    By sat in forum Excel General
    Replies: 5
    Last Post: 06-18-2005, 07:05 PM
  6. Removing Duplicates
    By sat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-18-2005, 07:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1