|re: "If you open it you will understand what I'm trying to do "|
Since you have not provided any "example data" in Sheet2, it's kind of hard to understand what you are doing, especially with Column B.
What do you mean by "print code"?
If I had to guess, I'd say that VLOOKUP might work for you, but since you haven't provided any "output data" in Sheet2, I can't really be sure.
Read up on VLOOKUP in the Excel Help files and see if that will do what you want.
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.