Comparing lists in 2 workbooks and copying missing rows into new W
Well, let's work through it a piece at a time:
1) Get the user to name one or both files; there are various
get-the-file-name dialogues out there, but GetOpenFilename is already built
into Excel. (Or so it says here; I've never tired it, but I expect it's
easy.)
2) Open both workbooks, of course, along with some error checking to be sure
they're both there and both of the expected type.
3) You didn't say exactly what sort of comparison will be going on here, but
the usual is a list in both workbooks of some item, each item uniquely
identified by (say) student ID, part number, VIN, SSN, whatever. My own
favorite way of identifying which items on one list are (or are not) to be
found on the other uses the MATCH function in a helper column:
=MATCH(RC1,'Other sheet'!C5,0)
This gets me a list of row numbers for the items that are on the other
sheet, and #N/A for each item that isn't. Usually I want to check both ways,
but that's up to you; the point heer is that you'll put something like that
MATCH formula up and down some column in one or both sheets, and after that
your program can look at the results to cross-check all the items.
4) After that you can...well, you can do whatever you wanted your program to
do. But maybe it's time to stop and let you ask more detailed questions, or
maybe tell me I misunderstood your goal completely.
--- "Brian" wrote:
I have two workbooks that I need to compare and then copy the data that is
missing from the original workbook (but present in the second one) into a
third new workbook. To complicate matters for every comparison the filename
of the workbooks to be compared chages.
|