+ Reply to Thread
Results 1 to 9 of 9

VBA Remove Duplicate Values From Multiple Columns

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Remove Duplicate Values From Multiple Columns

    Hi, I wonder whether someone could help me please.

    I'm using the code below to remove duplicate values from a column of cells, in this case column B.

    Please Login or Register  to view this content.
    The code works fine, but I'd now like to adapt this so I can remove the duplicates from columns B, C, D and F.

    I've tried over the last few days different methods but recieve 'Debug' errors.

    I just wondered whether someone may be able to look at this please and offer some guidance on how I may achieve this.

    Many thanks and kind regards

    Chris

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: VBA Remove Duplicate Values From Multiple Columns

    What about deleting those cells?

    Try this...

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Remove Duplicate Values From Multiple Columns

    Hi @Sixthsense, thank you for taking the time to come back to me about this.

    Unfortunately though, when I run the code I receive a Run time '1004' Method 'Range of Object'_Worksheet failed' error, with debug highlighting this line:

    Please Login or Register  to view this content.
    Many thanks and kind regards

    Chris

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,058

    Re: VBA Remove Duplicate Values From Multiple Columns

    Replace all instances of lrw with LR in the code.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Remove Duplicate Values From Multiple Columns

    HI @romperstomper, thank you for taking the time to reply to my post.

    I've made the changes as you kindly suggested, but unfortunately I receive a Run time error '438' Object doesn's support this poperty or method' error.

    Many thanks and kind regards

    Chris

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,058

    Re: VBA Remove Duplicate Values From Multiple Columns

    Are you running it on 2003? It won't work pre-2007.

    Do you want to remove duplicates from each column individually, or only remove rows where the combination of all specified columns is a duplicate?

  7. #7
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Remove Duplicate Values From Multiple Columns

    Hi @romperstomper thank you for coming back to me with this.

    I can confirm I'm running 2003 and I would like to remove duplicates from each column individually.

    Many thanks and kind regards

    Chris

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,058

    Re: VBA Remove Duplicate Values From Multiple Columns

    You could simply amend your original code to something like this:
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Remove Duplicate Values From Multiple Columns

    Hi @romperstomper, thnak you very much for coming back tio me with this.

    The solution works perfectly, thank you.

    All the best and kind regards

+ 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. Replies: 3
    Last Post: 04-09-2014, 06:10 AM
  2. [SOLVED] Checking for 4 duplicate values and remove columns
    By keis386 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2013, 05:56 AM
  3. [SOLVED] Remove duplicate rows by matching values across columns in Excel 2007
    By guest2013 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-15-2013, 12:00 AM
  4. excel macro to remove specific columns and rows + remove duplicate
    By garrywelson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-17-2013, 12:03 PM
  5. VBA Remove duplicate entries accross multiple columns??
    By siegreen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2010, 06:03 AM

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