+ Reply to Thread
Results 1 to 4 of 4

Copy & Paste Unique Cells Values

  1. #1
    Registered User
    Join Date
    09-10-2003
    Posts
    1

    Copy & Paste Unique Cells Values

    Hi! VBA Expert here

    I am looking for a module that read from G9:L(last row) and write the unique values into the cells M9:R (last row) with sorting left to right.

    Few Examples :

    G9:L14 M9:R14

    4 5 3 3 4 5 = 3 4 5
    2 2 3 6 7 0 = 0 2 3 6 7
    7 4 9 8 2 3 = 2 3 4 7 8 9
    7 9 9 0 1 8 = 0 1 7 8 9
    7 1 6 8 6 6 = 1 6 7 8
    6 7 9 1 7 6 = 1 6 7 9

    I wish the above example is clear for you to help me.
    Thanks for helping.

    Regards,
    Michael

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523
    Hi,

    UDF
    1) hit Alt + F11 to open VB Editor
    2) go to Insert - > Module then paste code there
    3) hit Alt + F11 again to get back to Excel

    in cell B1
    =sortcell(A1) or =sortcell(A1," ") ... second argument for delim chatcter

    Please Login or Register  to view this content.



    Quote Originally Posted by Michael168
    Hi! VBA Expert here

    I am looking for a module that read from G9:L(last row) and write the unique values into the cells M9:R (last row) with sorting left to right.

    Few Examples :

    G9:L14 M9:R14

    4 5 3 3 4 5 = 3 4 5
    2 2 3 6 7 0 = 0 2 3 6 7
    7 4 9 8 2 3 = 2 3 4 7 8 9
    7 9 9 0 1 8 = 0 1 7 8 9
    7 1 6 8 6 6 = 1 6 7 8
    6 7 9 1 7 6 = 1 6 7 9

    I wish the above example is clear for you to help me.
    Thanks for helping.

    Regards,
    Michael

  3. #3
    R.VENKATARAMAN
    Guest

    Re: Copy & Paste Unique Cells Values

    the following sub will find unique values from G9 downwards in column G and
    write in M9 and down in
    column M.
    I hope this is what you want.
    ------------
    Public Sub test()
    Dim cellone As Range
    Dim indexrange As Range
    Dim result As Range

    Set cellone = Range("g9")

    Set indexrange = Range(cellone, cellone.End(xlDown))
    Set result = Range("m9")
    indexrange.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=indexrange, _
    CopyToRange:=result, Unique:=True
    End Sub
    -------------------------
    I did not undestand your requirement reg <sort>
    sorting left toright can be done by clicking <opitons> in sort
    window(data-sort) and clicking <sort left to right>
    you can create macro by doing the operations.



    Michael168 <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi! VBA Expert here
    >
    > I am looking for a module that read from G9:L(last row) and write the
    > unique values into the cells M9:R (last row) with sorting left to
    > right.
    >
    > Few Examples :
    >
    > G9:L14 M9:R14
    >
    > 4 5 3 3 4 5 = 3 4 5
    > 2 2 3 6 7 0 = 0 2 3 6 7
    > 7 4 9 8 2 3 = 2 3 4 7 8 9
    > 7 9 9 0 1 8 = 0 1 7 8 9
    > 7 1 6 8 6 6 = 1 6 7 8
    > 6 7 9 1 7 6 = 1 6 7 9
    >
    > I wish the above example is clear for you to help me.
    > Thanks for helping.
    >
    > Regards,
    > Michael
    >
    >
    > --
    > Michael168
    > ------------------------------------------------------------------------
    > Michael168's Profile:

    http://www.excelforum.com/member.php...nfo&userid=605
    > View this thread: http://www.excelforum.com/showthread...hreadid=375538
    >




  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523
    Michael168,

    My misunderstanding.

    I thought the numbers are in "ONE CELL", so code in the previous post doen't work for you.

    The following code should work.
    Before you run the code, you need to select the range in question.
    e.g. G9:L14

    Please Login or Register  to view this content.

+ Reply to Thread

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