+ Reply to Thread
Results 1 to 8 of 8

Trouble using a variable range for removing duplicates.

  1. #1
    Registered User
    Join Date
    12-27-2018
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2013, 2016
    Posts
    25

    Trouble using a variable range for removing duplicates.

    Hi all, I'm sure this is just me not understanding the kind of variable I'm using, but here is my code

    Please Login or Register  to view this content.
    My issue is with the last step of the code. I've tried using ActiveSheet.Range(rango) as well as ActiveSheet.Range(Selection) but it tells me that it's an application-defined or object-defined error. I suspect that I'm either not defining the object appropriately, or I'm not using the correct syntax when trying to use that range to remove duplicates. Am I on the right track or am I going about this in the complete wrong direction? Thanks in advance.
    Last edited by FZappa; 06-18-2019 at 05:37 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Trouble using a variable range for removing duplicates.

    Probably just
    Please Login or Register  to view this content.

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. 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, and it also maintains VBA formatting.

    Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    12-27-2018
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2013, 2016
    Posts
    25

    Re: Trouble using a variable range for removing duplicates.

    Thanks for the advice. I've made the changes as requested.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Trouble using a variable range for removing duplicates.

    You're welcome. Thanks for adding the code tags.

    Did the suggested amendment work for you?



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  5. #5
    Registered User
    Join Date
    12-27-2018
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2013, 2016
    Posts
    25

    Re: Trouble using a variable range for removing duplicates.

    Right, I've tried implementing your solution

    Please Login or Register  to view this content.
    but now the error it gives me is 438: Object doesn't support this property or method

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Trouble using a variable range for removing duplicates.

    Try:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-27-2018
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2013, 2016
    Posts
    25

    Re: Trouble using a variable range for removing duplicates.

    Hi, sorry for the delayed reply. That definitely worked, thanks!

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,313

    Re: Trouble using a variable range for removing duplicates.

    You're welcome. Thanks for the rep.

+ 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. Removing Duplicates and sorting range as a 2d array
    By Redsun in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2017, 01:51 PM
  2. [SOLVED] Copy & Paste Columns to Specific Range while Removing Blanks & Duplicates
    By dondada82 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-15-2017, 11:31 AM
  3. Removing duplicates BELOW a certain range
    By vpan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2016, 05:30 PM
  4. Remove duplicates with variable range
    By markDuffy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2015, 03:46 PM
  5. [SOLVED] Removing duplicates from the range urgent please?
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2014, 07:00 PM
  6. Combo Box Input Range - Removing Duplicates
    By ccooper in forum Excel General
    Replies: 1
    Last Post: 08-02-2012, 11:40 AM
  7. Replies: 6
    Last Post: 03-29-2012, 12:16 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