+ Reply to Thread
Results 1 to 3 of 3

Loop Until it finds matching string

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    Calgary,Canada
    MS-Off Ver
    Excel 2010
    Posts
    50

    Loop Until it finds matching string

    Hello Experts,

    I have 2 spreadsheets each containing a column of datas I need to compare
    In spreadsheet 1, I have a column of data called ID1. In spreadsheet 2, I have a column of data called ID2.
    I defined the data in Spreadsheet 1 as a variable called "ID1", same thing for spreadsheet 2, "ID2".

    I need a (Loop+if) function that let me start at the first data in spread sheet one, searches for that data in spread sheet 2. If there is a match, both ID1 and ID2 will be copied to a 3rd spreadsheet, and if there is no match then they will be copied to a 4th spreadsheet. Then same thing all over again at the next data in spread sheet one.

    For the sake of easiness, lets assume both ID1 and ID2 will be starting at cell(2,1) in Spreadsheet 1 and 2.

    I kind of have an idea of what I am suppose to write but don't know how to put it together




    Please Login or Register  to view this content.

    Unless there's a search function that looks for "ID1" in spreadsheet 2 that I don't know about, I am not sure how to write the Loop/If
    I don't know if this makes sense to you, I am new to VBA.

    Thanks in advance!

    Hallet

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Loop Until it finds matching string

    I tried to match each item in column A of worksheet 1 with an item in column A of worksheet 2.
    If there was a match, I put that item in worksheet match.
    And if there was not a match, I put that item in worksheet non-match.

    I've left notes for you to change the name of the worksheets as needed.
    And notes for you to change the column as needed.

    Please Login or Register  to view this content.
    P.S. There could be items in Worksheet 2 which do not end up in either the Match or non-Match worksheets.
    Last edited by StevenM; 07-03-2012 at 02:34 PM. Reason: P.S.

  3. #3
    Registered User
    Join Date
    05-09-2012
    Location
    Calgary,Canada
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Loop Until it finds matching string

    Thank you so much for your time and inputs!
    Greatly appreciated!

+ 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