+ Reply to Thread
Results 1 to 5 of 5

Remove Duplicates and Sum Quantities

  1. #1
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Remove Duplicates and Sum Quantities

    I've written code that goes through a list of items and sums the quantities, but it's rather slow, so I'd like to find something that runs quicker.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Remove Duplicates and Sum Quantities

    Hello yawnzzzz,

    Deleting the rows is what is taking the time. Unless you have some need to delete all these rows on the worksheet, you could copy the unique values and their sums over to a different worksheet. That would speed the process up considerably.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Remove Duplicates and Sum Quantities

    I guessed that was part of it.

    I'll elaborate on my problem some more then by saying that there's 24 columns worth of data tied to each item.

    Is the copy/paste commands going to be the quickest way to copy all 24 columns or is there a faster way?

  4. #4
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Remove Duplicates and Sum Quantities

    I went searching, and I saw an example that is supposed to be quicker than copy and paste:

    Please Login or Register  to view this content.
    I'm trying to use that for my own example.

    Please Login or Register  to view this content.
    Any ideas why I'm getting a method 'Range' of object '_Worksheet' failed error message?

  5. #5
    Forum Contributor
    Join Date
    06-03-2008
    Posts
    387

    Re: Remove Duplicates and Sum Quantities

    I tried this code, and it worked.

    Please Login or Register  to view this content.
    Using this code, it took 26 seconds to run my test.

    Please Login or Register  to view this content.
    Using this code, it took 28 seconds to run my test.

    Using my original deleting methodology took 23 seconds....

    Any other ideas?

+ 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