+ Reply to Thread
Results 1 to 7 of 7

vba Match Two Sets of Data

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    vba Match Two Sets of Data

    I have two worksheets both with codes in column B I'll call them wksht 1 and wksht2.

    I need a macro to run down the codes in wksht2 and match them to wksh1 and if there are any codes on wksht 2 that are not on wksht2 paste them into wksht3.

    Many thanks.
    Last edited by timbo1957; 03-22-2011 at 04:58 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: vba Match Two Sets of Data

    1) Is B1 a title on each sheet? Data starts in B2?
    2) What other columns are being used, if any?


    Are you sure you need a 3rd sheet, the AutoFilter can be used to show you the non-matching values right on sheet2 without creating a 3rd sheet.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: vba Match Two Sets of Data

    The data starts in row 9 in wksht1 and row 8 in wksht2.

    Having a third worksheet is best because when I am on leave someone else can run the macro and see at a glance any new codes that need to be added. Non many know how to use Autofilter.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: vba Match Two Sets of Data

    You saw both questions, yes?

    Better yet, click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your workbook. Let's just work on the sheet directly.

  5. #5
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: vba Match Two Sets of Data

    Sorry, see attached. I want to match the master priam report to the download report and anything in column B on the download report that isn't in the priam report to appear on a seperate worksheet.

    I have cut the size of the worksheet down for posting purposes. It is usually 650 + rows long.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: vba Match Two Sets of Data

    hi, timbo1957, one of the options to obtain the result you need, run code "test". Please note, sheet names are hard-coded. if you change them the code will need changes as well.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: vba Match Two Sets of Data

    Many thanks watersev works brilliantly.

+ 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