Results 1 to 5 of 5

How to look for duplicates in first column, then copy / paste contents of second column?

Threaded View

  1. #1
    Registered User
    Join Date
    03-19-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    How to look for duplicates in first column, then copy / paste contents of second column?

    Hi,

    Very new VBA user here, but ran across an Excel problem that is seemingly unsolvable without VBA.

    I have item #'s in column "A," (let's say, item 10, 11, 12, 13, 14...) and product #'s in column "B" (let's say product #'s AA, AB, AC, AD). Some items have more than one product associated.

    How can I put all the product #'s for each item onto one row? See attachment for a small sample of the data.

    Thanks for any help!!

    Here is how I tried to write the code:
    Sub FindDuplicates()
    Dim RC As Integer
    Dim i As Integer, j As Integer
    
    'count the rows in the list
    RC = Range("A1").CurrentRegion.Rows.Count
    
    'loop through all the tags to find duplicates
    For i = 2 To RC
        For j = 2 To RC
            
            If Cells(i, 1) = Cells(j, 2) Then Cells(j, 4).Select
            Selection.Cut
            Cells(i, 5).PasteSpecial Paste:=x1PasteValues
            End If
        Next i
            Next j
    Attached Files Attached Files
    Last edited by speedyhub; 03-21-2012 at 09:01 AM. Reason: Add Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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