+ Reply to Thread
Results 1 to 6 of 6

vba to lookup 2 criteria, if found, copy/paste corresponding cells in first 3 columns

  1. #1
    Registered User
    Join Date
    04-11-2014
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    28

    vba to lookup 2 criteria, if found, copy/paste corresponding cells in first 3 columns

    Hi,

    The below code works when looking up 2 criteria and then copying and pasting corresponding row in column A to cell G1 (see Sheet1 on the attached file).

    A B C D
    1/1/2019 Y Yes 1
    1/2/2019 Y Yes 1
    1/3/2019 N No 2
    1/4/2019 Y Yes 1
    1/5/2019 Y Yes 1


    Please Login or Register  to view this content.
    I would very much appreciate if someone could help me figure out how to do the same thing with the above code but with following 2 scenarios (see Sheet2 on the attached file):
    1. copy corresponding row in columns A thru C to cell G1.
    2. What if the 2 criteria were in multiple rows (ex. rows 3 and 5)

    Thank you so much!!!
    Attached Files Attached Files
    Last edited by jejnycta; 04-16-2019 at 03:26 PM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: vba to lookup 2 criteria, if found, copy/paste corresponding cells in first 3 columns

    Administrative Note:

    jejnycta welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. 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, and it also maintains VBA formatting.

    Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    04-11-2014
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: vba to lookup 2 criteria, if found, copy/paste corresponding cells in first 3 columns

    Thanks for pointing that out. From now on, I will be make sure I do this for all codes I post.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: vba to lookup 2 criteria, if found, copy/paste corresponding cells in first 3 columns

    See next code
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-11-2014
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: vba to lookup 2 criteria, if found, copy/paste corresponding cells in first 3 columns

    Thank you PCI, your code works. Very much appreciate your help.

    God Bless!

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: vba to lookup 2 criteria, if found, copy/paste corresponding cells in first 3 columns

    Good news
    Happy Easter

+ 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] Lookup, when found copy certain cells
    By dutchmaste in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-04-2016, 08:11 AM
  2. Replies: 14
    Last Post: 10-29-2015, 07:29 PM
  3. [SOLVED] Compare two columns and copy and paste data from a third column when a match is found
    By GatorsBucs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-28-2013, 06:54 PM
  4. Macro to Copy/Paste Cells if Data is found with Filter
    By CMPidgeon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2012, 04:05 PM
  5. Compare 2 columns then copy and paste the adjucent cell value if match is found
    By smartisenthil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2012, 12:11 PM
  6. Copy and paste based on found cells using two spreadsheets with dynamic ranges
    By shawnsonline in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2012, 02:49 PM
  7. Copy and Paste Cells If Match Found
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-10-2008, 04:23 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