+ Reply to Thread
Results 1 to 10 of 10

copy two Columns into one and remove duplicates

  1. #1
    Registered User
    Join Date
    04-02-2012
    Location
    Earth
    MS-Off Ver
    Excel 2013
    Posts
    33

    Unhappy copy two Columns into one and remove duplicates

    i have two sets of data, both have a Column called Job number. In the second list there may be multiply instances of the job number. Also in the second instance of data there may be Job numbers that do not appear on the first list.

    My aim is to merge all the data from both lists into one as automatically as possible. Both lists are updates daily.

    My Line of thinking is to get the one Job number list and use Vlookup or sum product or sum if to do the rest

    to get the Job numbers as one list i am trying trying to use the following VBA called from a button click

    Please Login or Register  to view this content.
    any ideas why it wont work??

    thanks

  2. #2
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: copy two Columns into one and remove duplicates

    Do you have an example workbook?

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: copy two Columns into one and remove duplicates

    What do you mean by - it doesnt work? Are you getting any error?

    Also, you are pasting it in the same named range. Wont it overwrite the data?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: copy two Columns into one and remove duplicates

    Try this code without named ranges.
    Please Login or Register  to view this content.
    Put this code in a standard module.

  5. #5
    Registered User
    Join Date
    04-02-2012
    Location
    Earth
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: copy two Columns into one and remove duplicates

    cant remember the old code error but with the above i get this error

    subscript out of range

    here is the excel document

    Job summary template.xlsm

    thanks for looking

  6. #6
    Registered User
    Join Date
    04-02-2012
    Location
    Earth
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: copy two Columns into one and remove duplicates

    old error with original code is method range of object _worksheet failed

    hope that helps

    i don't want to over write data but append to the bottom before dedicating it

  7. #7
    Registered User
    Join Date
    04-02-2012
    Location
    Earth
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: copy two Columns into one and remove duplicates

    i have managed to get a code working for removing duplicates from the table column

    Please Login or Register  to view this content.
    now i just need a code to add to columns together under one the run the above

    any ideas?

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: copy two Columns into one and remove duplicates

    Try this code. It creates a temporary sheet called Temp where the columns are merged. It removes duplicates and then copies the contents to the SUMMARY DATA tab.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-02-2012
    Location
    Earth
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: copy two Columns into one and remove duplicates

    tweaked a little as second list job number is in column B

    but this works perfectly

    many thanks

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: copy two Columns into one and remove duplicates

    Am glad it worked.

+ Reply to Thread

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