Thanks for your reply Capungo..

Yes, I could use Vlookup function but the structure should be dynamic..whenever users add more records they should press refresh button and database should be updated automatically as users don't know how to set or extend the formulas..That's why I was looking for some code to use Vlookup in VBA - that's difficult though :o) however below code posted by Mark is working perfect..

Cheers
Yeliz

Quote Originally Posted by Capungo
Yeliz,

It sounds to me like you need a simple Vlookup function. As far as I can understand, you are trying to pull the G-column data on the Gross Salary.xls file to D-Column on the Payroll.xls file as long as the Employee ID matches.

This can be done by a simple formula instead of VBA code. Copy the formula below and paste it to D2 on Payroll.xls workbook. Then fill the formula down to the last row.

Turkish:

=EĞER(EHATALIYSA(DÜŞEYARA($A:$A;'[gross salary .xls].csv)50s.payroll(1)'!$A:$G;7;0));"";DÜŞEYARA($A:$A;'[gross salary .xls].csv)50s.payroll(1)'!$A:$G;7;0))

English:

=IF(ISERROR(VLOOKUP($A:$A,'[gross salary .xls].csv)50s.payroll(1)'!$A:$G,7,0)),"",VLOOKUP($A:$A,'[gross salary .xls].csv)50s.payroll(1)'!$A:$G,7,0))

I hope I didn't underestimated your question...