You need to write an =if( ) function to do this. It would look something like this
=IF(A1=Sheet1!B1,Sheet1!A1,IF(A1=Sheet1!B2,Sheet1!A2,0))
Place this in sheet 2 cell b1
This means that when you type 1 into sheet 2 in cell a1, cell b1 on sheet 2 will automatically be set to the value of cell b1 on sheet 1.