+ Reply to Thread
Results 1 to 5 of 5

Macro that copies values from one workbook to another, based on matching cells

  1. #1
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Macro that copies values from one workbook to another, based on matching cells

    1. I need a macro that compares the cells in the column called "Name" for the two workbooks. If the names match, values from the respective columns named INFO 3, INFO 4, INFO 5 and INFO 6, must be copied from "TestB" to "TestA" in their respective places.

    2. Notice that there are more columns named INFO3, INFO 4 etc. So i guess the code should not copy and paste the values based on the name of the columns, but rather their place in the workbook. It should then be considered that all the "INFO-columns" in "Test A" are shifted with 1 column, as it has the extra column "TAX" at column B.

    3. Some names are duplicates. Both for workbook "TestB" and "TestA". It doesnt really matter if the code puts wrong values in those or skips them, as Ill put in the values manually for those.

    4. Keep in mind that there are more than one sheet. The information is located in "Sheet1" for both workbooks.

    Thank you so much in advance!

    Alex
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Macro that copies values from one workbook to another, based on matching cells

    Anyone? :=)

  3. #3
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: Macro that copies values from one workbook to another, based on matching cells

    Hi @ Allerdrengen

    I found your unanswered request and tried to guess what your need is.
    I hope I understood well, so please try the following code, you can paste it in a standard module in any of your two books, ( or in both if you like).
    It will replace all the row in TestA, when the same name is found in TestB,
    furthermore, if the name has been repeated in TestA the thext will become bold, and if the name is repeated in TestB will become italic, so you can know where to act.
    when the name is repeated in TestB only the last occurrence will be shown in TestA, as you can see in the caso of Adrian.

    Please Login or Register  to view this content.
    Last edited by vichopalacios; 10-10-2017 at 04:08 PM.
    Barriers are there for those who don't want to dream

  4. #4
    Registered User
    Join Date
    04-03-2017
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    92

    Re: Macro that copies values from one workbook to another, based on matching cells

    Hi @vichopalacios

    Works like a charm! Thank you so much. And good idea with the bold text. Repped.

    Alex

  5. #5
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: Macro that copies values from one workbook to another, based on matching cells

    Glad to know I hit the nail at the first try.
    Please mark your thread as SOLVED, and thanks for the reps-

+ 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. Matching data from closed workbook with open workbook based on cell values
    By kbkrueger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2015, 07:42 PM
  2. Macro that copies certain cells only into a new workbook
    By BDarden in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2014, 11:27 AM
  3. Replies: 1
    Last Post: 06-06-2013, 07:39 PM
  4. Replies: 8
    Last Post: 01-26-2013, 12:25 AM
  5. [SOLVED] Customize code for a macro that copies three rows to a new workbook based on a condition
    By philips in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-04-2013, 05:55 AM
  6. [SOLVED] macro which copies all column values based on specific string inputs
    By buntalan80 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-12-2012, 03:08 PM
  7. Summing Ranges in workbook based on matching values
    By scaffdog845 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-13-2011, 02:02 PM

Tags for this Thread

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