+ Reply to Thread
Results 1 to 9 of 9

Can't remove duplicates from range

  1. #1
    Registered User
    Join Date
    04-02-2014
    Location
    SL
    MS-Off Ver
    Excel 2010
    Posts
    10

    Can't remove duplicates from range

    Hello,
    I have an excel table with several columns two of which I am interested in. What I am trying to do is filter the first column with a specific criterion and then copy the visible values from the other column into a range object. After that I need to remove duplicates. The problem is I get an error. Here's the code. There are a lot of duplicates. Please tell me what's wrong or suggest a better way to achieve the task I'm trying to do.

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Can't remove duplicates from range

    Check this out: http://spreadsheets.about.com/od/dat...s-tutorial.htm
    -------------
    Tony

  3. #3
    Registered User
    Join Date
    04-02-2014
    Location
    SL
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Can't remove duplicates from range

    Quote Originally Posted by BeachRock View Post
    That's not what I'm asking. That's not VBA !!

  4. #4
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Can't remove duplicates from range

    You said:
    Please tell me what's wrong or suggest a better way to achieve the task I'm trying to do.
    It was a suggestion...

  5. #5
    Registered User
    Join Date
    04-02-2014
    Location
    SL
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Can't remove duplicates from range

    How can a non VBA method help solve a VBA related problem ?

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Can't remove duplicates from range


    Hi !
    Quote Originally Posted by medwatt View Post
    The problem is I get an error.
    Very clear ! Shall we guess the error message and on which line ?!

  7. #7
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Can't remove duplicates from range

    Granted, my suggestion does nothing for your ability to filter the first column with a specific criterion and then copy the visible values from the other column into a range object. However, there are other ways than VBA to remove duplicates.

    Good luck with your problem.

  8. #8
    Registered User
    Join Date
    04-02-2014
    Location
    SL
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Can't remove duplicates from range

    Here is where I get the error:
    rng1.RemoveDuplicates Columns:=1, Header:=xlNo

    Also if I say rng1.rows.count I get 12 but if I say rng1.count I get 71 which is the actual number.

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Can't remove duplicates from range


    The interesting one for this method is the Columns.Count and on which one are the duplicates,
    see vba help of RemoveDuplicates …

    Maybe the issue came 'cause of an active filter (non-contiguous cells), try without
    or after pasting visible cells on another place and thus launch on it the RemoveDuplicates method …

+ 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. [SOLVED] Remove Duplicates and Spaces within a Range in a Row
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2014, 01:33 PM
  2. Range in Remove duplicates
    By nsv in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2012, 05:33 AM
  3. Replies: 5
    Last Post: 07-25-2011, 09:42 PM
  4. Replies: 2
    Last Post: 03-20-2011, 11:19 AM
  5. Remove Duplicates in a Dynamic Range using Excel 2007
    By nsorden in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-22-2009, 10:24 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