+ Reply to Thread
Results 1 to 2 of 2

A macro to copy & Paste unique value to other cells

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    378

    A macro to copy & Paste unique value to other cells

    hello,

    Is there a way to have a macro code to copy an array start from column B47 to the last B row has the data and paste unique value to column O24 to O41? If there is a formula for it, that would be awesome as well.

    Thanks

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: A macro to copy & Paste unique value to other cells

    How about:

    Sub CaptureUniques()
        Dim col As Collection
        Set col = New Collection
        Dim rB As Range, rO As Range
        Set rB = Range(Range("B47"), Range("B47").End(xlDown))
        Set rO = Range("O24")
        For Each r In rB
            On Error Resume Next
            col.Add r.Value, CStr(r.Value)
            If Err.Number = 0 Then
                rO.Value = r.Value
                Set rO = rO.Offset(1, 0)
            End If
        Next r
    End Sub
    Gary's Student

+ 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