Results 1 to 4 of 4

Sort & Filter Unique items

Threaded View

  1. #1
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Sort & Filter Unique items

    I thought it would be easy to run the Macro recorder.
    First record a Sort. Then record the AdvancedFilter on Unique items.
    Triggered both Macros by a Worksheet Change event.

    Problems:
    1. Sort Only works with a 1 (number or text) in the first position - under INPUT (B5:B16)
    2. FilterUnique don't filter the above 1, leaving two 1's - under OUTPUT (C5)

    What am I missing?
    Ola

    Example file attached
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim Myrange As Range
    Range("B5:B16").Name = "Myrange"
        
    Sort
    FilterUnique
    
    End Sub
    -------------------
    Sub Sort()
    
        Range("Myrange").Sort _
         Key1:=Range("B5"), _
         Order1:=xlAscending, _
         Header:=xlGuess, _
         MatchCase:=False, _
         Orientation:=xlTopToBottom, _
         DataOption1:=xlSortTextAsNumbers
    
    End Sub
    --------------------
    Sub FilterUnique()
    
        Range("Myrange").AdvancedFilter _
         Action:=xlFilterCopy, _
         CopyToRange:=Range("C5"), _
         Unique:=True
    
    End Sub
    Attached Files Attached Files

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