+ Reply to Thread
Results 1 to 3 of 3

Macro to Compare two sheets, if match then copy two cells from one sheet to the other

  1. #1
    Registered User
    Join Date
    06-20-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Macro to Compare two sheets, if match then copy two cells from one sheet to the other

    I'm still new but I think this breakdown explains it best...

    I need a Macro that accomplishes the following:

    I need to compare Column "A" of worksheet "Master" (Workbook named same) against Column "X" of Worksheet "Report" (Workbook named same)
    If a match is found, copy cells (in the same row the match was found in "Report") from Column "A" and "AS" of "Report"
    Then paste those two copied cells into (the row where the match was found in "Master") Columns "AC" and "AF" of "Master"

    Hopefully it's not too difficult... Many thanks in advance.

    P.S. - I tried posting like this once before and a "SUPERHERO" by the name of StevenM managed to provide the most awesome Macro to solve my problem. I hope someone can do the same in this instance.

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Macro to Compare two sheets, if match then copy two cells from one sheet to the other

    Please post a sample workbook and I'll take a swing at it. It would be nice if you could put explanatory comments in your sample book as well as what you'd like the output to look like. I have a pretty good grasp of what you're after but not too sure.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

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

    Re: Macro to Compare two sheets, if match then copy two cells from one sheet to the other

    Backup your data.
    Copy the following code in a standard module.
    Run: CopyAnAS2ACnAF

    Please Login or Register  to view this content.
    The code is very basic (and you should be able to fix anything if I didn't understand what you wanted).
    (1) I go through Column A of worksheet "Master"
    (2) I look for a match in column X of "Report"
    (3) If match is found two items are copied.
    The left side of equals is a cell in worksheet "Master"
    The right side of equals is a cell in worksheet "Report"

    In the future, when you make such a request, it helps if you have a mock workbook uploaded. It would help me to better understanding what you need, and then I can use that workbook to test the code I'm writing.

    Also, you can change the name of the macro to something more meaningful.

+ 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