+ Reply to Thread
Results 1 to 7 of 7

Remove duplicates from dynamic row counts

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Remove duplicates from dynamic row counts

    Hello
    Please let me begin by saying it has been a couple years since trying to write any vba.

    I have the range (A2:Q2) that contains the first value for each column (Header is on row 1)
    Each row count is different for each column.
    Each column could contain duplicates (each column has to have duplicates removed individually).

    Ex: Column 1
    A2 = Bob
    A3 = Tom
    A4 = Bob
    A5 = Tom
    A6 = Mike

    Column 2
    B2 = 10
    B3 = 20
    B4 = 20

    Column 3
    C2 = Mike
    C3 = Ralph
    C4 = Tom
    C5 = Brad

    Column 1 has duplicates and need to be removed only for that column
    Column 2 has duplicates and need to be removed only for that column
    Column 3 doesn't contain duplicates, but it may in the future.

    I have 17 columns with varying row lengths
    Ive tried several ways to do this, but nothing seems to work.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Any Suggestions?

    Thank You
    Terry

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Remove duplicates from dynamic row counts

    Hi tvanduzee,

    Try this code:
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Remove duplicates from dynamic row counts

    Hi tvanduzee,

    I'm working on a better style of coding using CurrentRegion. See it below which should also work for your problem.
    Please Login or Register  to view this content.
    Other programmers might want to use a ScriptingDictionary to solve this problem.

  4. #4
    Registered User
    Join Date
    03-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Remove duplicates from dynamic row counts

    Worked Great, thank you
    I'll have to study the code to understand it, but it works great.

    Thank You
    Terry

  5. #5
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Remove duplicates from dynamic row counts

    Other programmers might want to use a ScriptingDictionary to solve this problem.
    Please Login or Register  to view this content.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Remove duplicates from dynamic row counts

    Hi mohadin,

    I couldn't get your code to work to solve this problem. Could you supply a workbook with the code in it? I'm not good with Scripting Dictionary yet and would love to learn more.
    It seemed to me that the .CurrentRegion.ClearContents would clear the entire sheet from the beginning. Also I can't get your code to compile as "k" isn't defined.

  7. #7
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Remove duplicates from dynamic row counts

    Quote Originally Posted by MarvinP View Post
    Hi mohadin,

    I couldn't get your code to work to solve this problem. Could you supply a workbook with the code in it? I'm not good with Scripting Dictionary yet and would love to learn more.
    It seemed to me that the .CurrentRegion.ClearContents would clear the entire sheet from the beginning. Also I can't get your code to compile as "k" isn't defined.
    Hi
    Terribly sorry I did not noticed till now
    Accidently
    k has nothing to do I just forget to delete it
    Attached Files Attached Files

+ 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. Dynamic remove duplicates
    By ashishkhurana93 in forum Excel General
    Replies: 6
    Last Post: 06-15-2018, 02:36 AM
  2. Filtering and Total counts of duplicates from multiple columns
    By kor123 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-23-2016, 11:55 PM
  3. Formula that counts everything except duplicates...
    By mikeross in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-22-2014, 02:13 AM
  4. Multicolumn dynamic Listbox - Remove Duplicates in Listbox
    By s2jrchoi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2014, 12:30 PM
  5. [SOLVED] Help! How do I combine duplicates with different counts of inventory?
    By tybles in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-27-2013, 09:25 PM
  6. 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
  7. Ignore Duplicates in Counts
    By dfq in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-15-2007, 03:11 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