none
VBA - Copying and pasting rows in a datasheet based on 2 conditions in another datasheet RRS feed

  • Question

  • Hi,

    I have 2 datasheets, the first contains a list of data (approx 1000 rows) this data identifies different visits for each person (and ID number in one column identifies the person and a visit code in another column which identifies the visit for that person) and the 2nd contains data relating to the people in the 1st datasheet that I would like to merge with the 1st datasheet. The problem is datasheet 2 contains approx 5000 rows as it has many other people and their visits logged. I would like to find a way within excel that would allow me to search the id column and visit code column in datasheet 2 to search for matches to the same to columns in data sheet 1. If a match is found I would like the row of data pertaining to the matched id and visit code pasted into another spreadsheet (datasheet3). In the case were a search item in datasheet 1 cannot be found in datasheet 2 I would like an empty row to be put into the datasheet 3. Any help would be appreciated.

    Dervla


    • Edited by dfarrel7 Monday, November 19, 2012 4:24 PM more accurate title
    Monday, November 19, 2012 4:01 PM

All replies

  • What column is the ID number in? What column identifies the visit? Are the columns the same on the two worksheets? Do you want blank lines when there is no match or do you want the data as a block?
    Monday, November 19, 2012 6:27 PM