+ Reply to Thread
Results 1 to 3 of 3

VBA Compare Two Columns and Copy Matching Data

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Compare Two Columns and Copy Matching Data

    Hi, I wonder whether somoene may be able to help me please.

    I'm using the code below to compare columns on two sheets (1 column for each) and where there is a match, copy data from the 'Source' to 'Destination' sheet.

    Please Login or Register  to view this content.
    The code works fine, but I'd like to amend this, but I'm a little unsure about how to proceed.

    The script currently compares column C on the 'Source' sheet with column D on the 'Destination' sheet and where a match is found copy column G from the 'Source' sheet and pastes this to column O on the 'Destination' sheet.

    I'd still like to copy and paste the same columns, but I'd like to compare two columns from each sheet, so from the 'Source' sheet compare columns C and E to columns D and J on the 'Destination' sheet.

    I just wondered whether someone could possibly look at this please and offer some guidance on how I may achieve this.

    Many thanks and kind regards
    Last edited by hobbiton73; 02-18-2014 at 05:55 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA Compare Two Columns and Copy Matching Data

    Christ,
    This is mick's code.
    I do not have any data to test it on.

    Please Login or Register  to view this content.
    Last edited by AB33; 02-18-2014 at 06:21 AM.

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Compare Two Columns and Copy Matching Data

    Hi @AB33, thank you for taking the time to reply to my post.

    As you say this was @MickG's code, with also your help at this link: http://www.excelforum.com/excel-prog...opy-cells.html,which created the script above. My apologies for not making reference to this in my original post and if this caused offence, it was certainly not my intention.

    I've amended the code to included your revisions, and it works perfectly, thank you very much.

    All the best and kind regards

    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Formula to Compare and Copy to New Sheet Multiple Matching Records
    By virgIris13 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-11-2013, 03:00 PM
  2. Compare row and highlight matching data Macro
    By damdam in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-17-2013, 12:45 PM
  3. trying to compare two worksheets for matching data
    By dc50 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2012, 06:04 PM
  4. Replies: 6
    Last Post: 03-08-2011, 06:34 PM
  5. Compare 2 columns and highlight matching data
    By schueyisking in forum Excel General
    Replies: 3
    Last Post: 08-13-2009, 10:47 AM

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