Consulting

Results 1 to 8 of 8

Thread: VBA: Cross-match first two sheets and save result sheet as excel workbook.

  1. #1
    VBAX Regular
    Joined
    Jan 2019
    Posts
    14
    Location

    VBA: Cross-match first two sheets and save result sheet as excel workbook.

    Crossmatch first ID in ColumnB2/sheetA with all IDs in ColumnB/SheetB and find match/mismatch in a new next sheet "RESULT" and save as MS excel workbook with the name of the first ID in ColumnB2/sheetA.
    PS. IDs can also have no data at all in rows in either sheet.
    PS. Data can be upto any column.
    Attached Files Attached Files

  2. #2
    VBAX Regular
    Joined
    Jan 2019
    Posts
    14
    Location

  3. #3
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi tyavan!
    If there are contents behind x-name2, x-name3,etc... what should we do?

  4. #4
    VBAX Regular
    Joined
    Jan 2019
    Posts
    14
    Location
    For you I understood my mistake. I am totally wrong in writing my requirement.



    In SheetA: The first column is ID. And each id has data in respective cells rows. Here mock data in the attached sheet of ID "
    x-name1" is from 2B to 2L in cell rows.

    Similarly in SheetB:
    The first column is ID. And each id has data in respective row cells.



    Now, Crossmatch first ID data (i.e in the row starting from B2) with all ID data in sheetB one by one.

    The expected result is given in the RESULT sheet with defined headlines.

    And find match/mismatch in a new next sheet "RESULT" and save as MS excel workbook with the name of the first ID in ColumnA2/sheetA.

    PS. IDs can also have no data at all in rows in either sheet.
    PS. Data can be upto any column.

  5. #5
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Sorry i still don't quite catch your meaning.
    for example, there are contents behind SheetA's x-name1 and x-name2,
    and SheetB content unchanged, then the result:
    x-name1 1a_6
    x-name1 1a_7
    x-name1 1a_8
    x-name1 1a_9
    x-name2 1a_6
    x-name2 1a_7
    x-name2 1a_8
    x-name2 1a_9
    Is this understanding correct?

  6. #6
    VBAX Regular
    Joined
    Jan 2019
    Posts
    14
    Location
    They are just ID and this is how VBA will crossmatch ID data.
    In Result sheet column C to F need to full filed as per match and mismatch.

    For example, I want to crossmatch x-name1 with 1a_6 as below. Based on this data I want to find matching and mismatching data with their place of occurrence and fill the RESULT sheet.

    ID-B 1 2 3 4 5 6 7 8 9 10 11
    x-name1 I am going to London from there we will visit Japan []
    1a_6 I am going to London from there we will visit Japan []

    The crossmatch result x-name1 with 1a_6 "in RESULT sheet is row no 2 data".



  7. #7
    VBAX Regular
    Joined
    Jan 2019
    Posts
    14
    Location
    The crossmatch result x-name1 with 1a_6 " resulted in RESULT sheet row 2 data". This is just one crossmatch. Similarly, x-name1 need to be cross-matched with other IDs i.e, 1a_7 to 1a_9 and we will get the result in next row one by one. Hope this is clear now. I also need to select the range of rows and columns as there are blank cells occurring randomly.

  8. #8
    VBAX Regular
    Joined
    Jan 2019
    Posts
    14
    Location
    I need the result as it is in excel sheet. Is it possible?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •