Consulting

Results 1 to 3 of 3

Thread: how to grab filter list data

  1. #1
    VBAX Regular
    Joined
    Jan 2009
    Posts
    89
    Location

    how to grab filter list data

    I'm trying to find a way to use a macro to list each unique number from the Auto Filter list. Want the macro to output the data as follows,
    0.06 to G1
    0.25 to G2
    0.44 to G3
    ect.

    AutoFilter.jpg

  2. #2
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    give this a go
    Sub UniqueItems()
        Dim MyArray As Variant
        Dim dDictionary As Object
        Dim Index As Long
        MyArray = ActiveSheet.[C1].Resize(ActiveSheet.[C65536].End(xlUp).Row)
        Set dDictionary = CreateObject("scripting.dictionary")
        For Index = 1 To UBound(MyArray)
            dDictionary(MyArray(Index, 1)) = dDictionary(MyArray(Index, 1)) + 1
        Next
        ActiveSheet.[G1].Resize(dDictionary.Count) = Application.Transpose(dDictionary.Keys)
        Set dDictionary = Nothing
    End Sub

  3. #3
    VBAX Regular
    Joined
    Jan 2009
    Posts
    89
    Location
    Thank you very much! Worked perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •