Consulting

Results 1 to 10 of 10

Thread: vba - Extract Unique values from Single Column via Colllection and Dictionary

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned VBAX Contributor
    Joined
    Aug 2017
    Posts
    144
    Location

    vba - Extract Unique values from Single Column via Colllection and Dictionary

    Hi Team, 
    
    
    Need vba collection and dictionary help for extracting unique values of Single Column and pasting in Range(d2") via Dictionary
    and Range("h2") via Collection
    
    
    Unique values should be excluding blank. Below is my attempted Code not working. 
    
    
    Sub Unique_List_via_Collection()    
    
    
        Dim lr As Long
        Dim i As Long    
        Dim Coll As New Collection    
        lr = Range("a65000").End(xlUp).Row    
    
    
        For i = 2 To lr
            If Range("a" & i).Value <> "" Then
                On Error Resume Next
                Coll.Add Range("A" & i).Value, Range("A" & i).Value
                On Error GoTo 0
            End If
        Next i
    
    
            getting error at below line.
        Range("d2").Resize(Coll.Count).Value = Application.WorksheetFunction.Transpose(Coll.Items)  
    
           
    End Sub
    
    Thanks in advance for help.      
    
    Regards,
    mg
    Attached Files Attached Files

Posting Permissions

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