+ Reply to Thread
Results 1 to 5 of 5

Macro to count unique values in a column, enter it in next column, then delete duplicates

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    3

    Macro to count unique values in a column, enter it in next column, then delete duplicates

    I'm new to VBA programming, and would appreciate some help on this macro. I wrote the following code to sort a column containing ~6500 rows of user names, count how many times each one occurs, and write that count beside it. As a final step, I want to delete all duplicate rows within the worksheet so I'm left with unique user names, and the count of how many times each one occurred in the original data.

    Please Login or Register  to view this content.
    I'm thinking that another For Each-Next loop would accomplish my goal, but I'm unsure of how to proceed. Any ideas?

    Thank you
    Attached Files Attached Files
    Last edited by pmorisse; 01-25-2013 at 03:19 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Macro to count unique values in a column, enter it in next column, then delete duplica

    Hi

    Post a sample file
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to count unique values in a column, enter it in next column, then delete duplica

    I do not know which columns are the duplicates in, but assuming that they are in column A, this will give you a good start
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-22-2013
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to count unique values in a column, enter it in next column, then delete duplica

    In my original post, I added an approximation of the file I'm working with.

  5. #5
    Registered User
    Join Date
    01-22-2013
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to count unique values in a column, enter it in next column, then delete duplica

    Thanks AB33. After modifying the sheet name, this code did the job nicely. I'll be working with monthly data, so I'll modify your "With" statement to run on the active sheet.

    Much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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