Results 1 to 5 of 5

Create Unique List in Shortest Time

Threaded View

  1. #1
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Create Unique List in Shortest Time

    I have a list of project numbers that is over 7000 rows long [example attached].
    Many numbers are repeated. This list comes out of a financial reporting system.
    I need to extract a list of unique numbers in numerical order.
    I have two solutions working, one with SUMPRODUCT formulas and one with MACRO.
    Here's the MACRO solution.
    But it takes about 20 seconds to execute.
    I am just looking to cut down on execution time. I am using this macro a few times on different lists in the same program.

    Is there a better [faster] way to do this?

    Sub UniqueOrder()
    Sheets("Sheet1").Select
    Dim LR As Long
    LR = Range("A" & Rows.Count).End(xlUp).Row
    
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    
    For i = LR To 2 Step -1
        If WorksheetFunction.CountIf(Columns("A:A"), Cells(i, "A")) > 1 Then _
                             Rows(i).EntireRow.Delete Shift:=xlUp
    Next i
    Application.ScreenUpdating = True
    Application.EnableEvents = True
    End Sub

    Thanks for any helpful hints.
    modytrane
    Attached Files Attached Files
    Last edited by modytrane; 06-17-2009 at 03:55 PM. Reason: solved

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