Results 1 to 3 of 3

Thread: Generate A List of Unique Values / Unique Array

  1. #1
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    14

    Generate A List of Unique Values / Unique Array

    Hi,
    I would like to get a unique list and if you ordered the following code to obtain the individual columns in a multiple selection
    What should I make changes to the code

    Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Dim tArr() As Variant
        ReDim tArr(0)
        For Each celle In Target
            i = i + 1
            tArr(UBound(tArr)) = celle.Column
            ReDim Preserve tArr(UBound(tArr) + 1)
        Next
        ReDim Preserve tArr(UBound(tArr) - 1)   '???
        For Each COLONNA In tArr()
            MsgBox COLONNA
        Next
    End Sub

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    14
    Hi,

    I solved using only the form: mod_SortAndUnique
    Now in a spreadsheet use

    Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Dim tArr() As Variant
        ReDim tArr(0)
        For Each celle In Target
            i = i + 1
            tArr(UBound(tArr)) = celle.Column
            ReDim Preserve tArr(UBound(tArr) + 1)
        Next
        Product = SORTSDARRAY(tArr, Ascending)
        Product = UNIQUEVALUES(Product)
        For Each COLONNA In Product
            MsgBox COLONNA
        Next
    End Sub

Similar Threads

  1. Numbered List Of Unique Values
    By xander1981 in forum Excel Help
    Replies: 6
    Last Post: 01-21-2013, 06:10 PM
  2. Extract Unique Values List
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 4
    Last Post: 03-06-2012, 09:51 PM
  3. List Unique Values Using Formula
    By LalitPandey87 in forum Excel Help
    Replies: 5
    Last Post: 01-09-2012, 08:39 PM
  4. Unique Large Values From Duplicate List
    By S M C in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 10-04-2011, 02:17 AM
  5. List Unique/Common Values From Two Ranges
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 09-16-2011, 08:34 AM

Posting Permissions

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