Merging Data from Two Different Workbooks on a Common Key
You are a saint! I do not know how to thank you. I would reciprocate, but I
know that my skills are far inferior to your own. :-)
Thank you!
"JLatham" wrote:
No need to move things around, we'll set up column 'mapping' in the code.
This will allow it to work right from the outset as you have things set up
now, and will permit you to rearrange things in either book later, with just
a little code alteration to keep it working with any such new arrangement.
I'm off to work on this now - turns out the other user needs almost exactly
the same thing [didn't really want automatic updates in real time, so I'm
converting that code to 'on-demand' macro and can get double-duty-use out of
it :-) ]
"Alan Auerbach" wrote:
Thank you so much for offering to assist me!
The keys for the shorter workbook are in column A and for the longer
workbook they are in column B, but there is no reason I cannot delete column
A which would put all the keys in column A. Once the original column A is
deleted, the address data in the longer workbook is in columns J, K, L, M and
N. The address data in the shorter workbook (to be replaced with information
from the longer workbook) is in columns F, G, H, I and J.
The goal is to use the keys in the shorter workbook to lookup the data in
the longer workbook and, for each key in the shorter workbook, to replace the
data in columns F, G, H, I and J with the data in the longer workbook located
in columns J, K, L, M and N.
"JLatham" wrote:
I don't have the code ready to post here right this minute. But I just
finished up helping someone who contacted me direct with something similar -
but they wanted the moves from one workbook to the other to happen
automatically, so the code is not in the form that could be tossed right into
a macro at the moment. If no one else responds very shortly, I'll modify the
code and put it up here and you can alter it to suit you needs. How many
columns of information need to be moved from each row from one book to the
other?
"Alan Auerbach" wrote:
I have two workbooks with different information--and a different number of
records--but a common column that can be used as a key. Can the smaller
workbook be used, with the common keys, to look up rows in the second
workbook and either import the data in specified columns or replace the data
in specified columns in the shorter workbook with data in the specified
columns in the larger workbook? To be explicit, the two workbooks have
address data that needs to be replaced in one.
I will greatly appreciate any comments and assistnace for creating this merge.
/s/ Alan Auerbach
|