Hello,

I am new to the forum. I am also pretty new to VBA programming (this is only my 2nd venture into utilizing it).

Here is the issue at hand:
Working with two separate workbooks, I need to copy information from Staff Roster (such as an employee #) and search Master USER IDs for that number, then copy and paste the corresponding user ID from Master USER IDs back into a cell on the same line as the employee # in the selected empty cell in the appropriately titled column on the Staff Roster workbook. The search in Master USER IDs could cover as many as 50,000 lines. The search on Master USER IDs will always be in the same column, the copy of the desired data will always come from the same column, and the result to be carried back to Staff Roster is always pasted in the same column.

It's not as complicated as explaining out is. I've been doing this function with cut, paste, find and alt+tab to flip between the two sheets. It works that way, but it is time consuming; I'd prefer to automate.

I have used the macro recorder to come up with this code:

Please Login or Register  to view this content.
This works on one line. I cannot figure out how to 1) get the macro to advance to the next row down, copy the next employee # and repeat the tasks again; and 2) how to make this macro loop until the end of workbook A.
I have attached sample worksheets (sample Master User IDs, sample Staff Roster).

sample Staff Roster.xlsm sample Master User IDs.xlsx

I think the resolution could be a simple tweak of what the recorder has provided.

I have to utilize this kind of function very frequently, and I would like to be able to change the commands to fit the appropriate variables (i.e. instead of searching for the USER ID, I might need to search for the name, or email address, etc). Usually I will search by employee #, but not always. I am guessing to change the parameters, I would enter the new cell coordinates? Also, the source and search workbooks may be completely different as well, but the function I need to complete will be the same (copy source from one, search the other, paste back the desired result on the source sheet).

Thanks for your assistance. Let me know if additional clarification is required.
Patti