+ Reply to Thread
Results 1 to 4 of 4

Compare cells in 2 columns in separate WBs and return data in Col 38-40 if there is match

  1. #1
    Registered User
    Join Date
    09-04-2016
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    3

    Compare cells in 2 columns in separate WBs and return data in Col 38-40 if there is match

    Hi

    I am attempting to compare 2 columns in separate workbooks, and if a match is found, to return the data in columns 38-40 from one workbook into columns 38-40 of the second workbook. I thought the best way to do this was to progressively loop through the values of the column in WB1, and compare with the other WB using a vlookup function. Unfortunately macros are not my strongest suit and essentially I've been trying to draw upon my knowledge of other coding languages and translate it into macro. This probably isn't the best way. I'm currently going through tutorials in order to find a more efficient way to do this function, but in the meantime, here's what I have:

    Please Login or Register  to view this content.
    The workbooks will vary on a week by week basis, thus I thought to define them earlier to make it easier to adjust, and the range of active cells in the sheet will vary week by week too (not sure if I've properly defined the array). Code seems to be getting stuck once it hits the Vlookups so I must be doing something wrong there. This is probably a pretty terrible code but any advice would be appreciated.

    Thanks!
    Last edited by krispykreme; 09-05-2016 at 12:33 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: Compare cells in 2 columns in separate WBs and return data in Col 38-40 if there is ma

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-04-2016
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    3

    Re: Compare cells in 2 columns in separate WBs and return data in Col 38-40 if there is ma

    Ah right thanks for that Alan, I'll be mindful in the future.

  4. #4
    Registered User
    Join Date
    09-04-2016
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    3

    Re: Compare cells in 2 columns in separate WBs and return data in Col 38-40 if there is ma

    Any ideas?

+ 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. compare two columns and return match from third column
    By ozza89 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 03-08-2014, 05:24 AM
  2. Compare 2 columns and return the best match
    By uberathlete in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2013, 06:44 AM
  3. [SOLVED] Compare two columns with data, if match or not found then change the colour of cells
    By Sachy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-15-2013, 03:58 AM
  4. [SOLVED] Compare data in columns of two worksheets and return value if match.
    By Zoediak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-02-2013, 10:38 AM
  5. How to compare columns and return one value if they match
    By louise0502 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-16-2013, 11:10 AM
  6. [SOLVED] Compare strings for match in separate worksheet and return nearest future date
    By kungfood in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-05-2012, 05:19 PM
  7. Replies: 10
    Last Post: 07-10-2012, 03:01 PM

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