+ Reply to Thread
Results 1 to 6 of 6

VBA for loop and Compare od datas in two different sheets

  1. #1
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    VBA for loop and Compare od datas in two different sheets

    I have got 2 sheets patch and NA.

    I want to compare the data in the 'Patch' sheet with 'NA' and delete the data in the 'Patch' sheet that matches with the ones in the 'NA' sheet.

    I have attached the sheets here.

    can anyone please help me out in resolving this?

    Thanks in advance!
    Attached Files Attached Files
    Last edited by sarajun_88; 11-27-2014 at 10:19 PM.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: VBA for loop and Compare od datas in two different sheets

    Hi sarajun_88,

    Welcome to the forum!!

    Try this (initially on a copy of your data as the results cannot be undone if they're not as expected):

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Re: VBA for loop and Compare od datas in two different sheets

    Wow!! Thanks a million Robert !!

    This worked like a magic. This is what I wanted.

  4. #4
    Registered User
    Join Date
    11-28-2014
    Location
    Gent
    MS-Off Ver
    Excel Professional 2010
    Posts
    6

    Re: [SOLVED] VBA for loop and Compare od datas in two different sheets

    Hello,

    I am in deserate need of a macro that will compare the same column in 2 separate worksheets and then copy in the second sheet only the cells that don't match.
    I attached an example. Sheet 1 contains more rows than Sheet 2, and the macro should compare column B in both sheets and then write in Sheet 2 the cells from column B that are not found in the same column B in Sheet2 (in my example Sheet 3 is a representation of how Sheet 2 would look like after executing the macro).

    I tried using the info already presented in the forum, but 1 day later I have no satisfactory result.

    Can someone help?

    Thank you a million!

    N
    Attached Files Attached Files
    Last edited by nicoletanistor; 12-02-2014 at 09:21 AM. Reason: solution given

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: VBA for loop and Compare od datas in two different sheets

    Hi sarajun_88,

    Thanks for the feedback and if you could mark thread as solved it would be appreciated.

    Hi nicoletanistor,

    Please take a moment and re-read rule 2 of our forum rules here that you agreed to when you signed up as posting a question in someone else's thread is in breach of them.

    That said and as you're new I have written this for you - this time:

    Please Login or Register  to view this content.
    Regards,

    Robert
    Last edited by Trebor76; 11-29-2014 at 09:13 AM.

  6. #6
    Registered User
    Join Date
    11-28-2014
    Location
    Gent
    MS-Off Ver
    Excel Professional 2010
    Posts
    6

    Re: VBA for loop and Compare od datas in two different sheets

    Thank you Robert for the reply. I know I should've not posted here, but I must say I couldn't find where I can start a new thread.. can you maybe help with a link? I am not that internet newby, but it was just not apparent. I only found a place where I could introduce myself..

    As for the solution, it works perfectly, but it doesn't really solve my problem because I think I didn't explain it very well: the macro should check for each cell in column B from Sheet1 if it already exists in column B in Sheet2 and if it doesn't exist, then copy it at the end of what is written in column B in Sheet2. So basically it needs an extra verification if that field is already in Sheet 2. At the moment it copies everything from Sheet1.

    Thank you again,

    Nicoleta

+ 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. [SOLVED] How to Compare 2 sheets datas on a single sheet in very quickly
    By PRADEEPB270 in forum Excel General
    Replies: 6
    Last Post: 09-30-2013, 08:24 AM
  2. compare oracle table datas and excel datas
    By james94539 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2013, 03:48 PM
  3. using for loop to compare two sheets
    By deviaug28 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-16-2009, 01:08 PM
  4. How to compare datas in excel sheet
    By deviaug28 in forum Excel General
    Replies: 3
    Last Post: 12-03-2009, 01:27 AM
  5. [SOLVED] Compare two columns datas
    By Franck in forum Excel General
    Replies: 1
    Last Post: 04-18-2005, 06:06 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