Search and copy macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having two exel files. I need a macro that looks at the number in file1
cell B2, searches that number in file2 column B and copies a number in that
row (Mx) to cell C2 in file1. It has to do that for the whole column B in
file1.

I found some simmilar tutorials, like this one:
http://cpearson.com/excel/duplicat.htm

but I can't figure out how to do exactlly what I need.

Any help would be great!
 
in C2

=if(C2<>"",Vlookup($B2,[File2.xls]Sheet1!$A$1:$F$200,3,False),"")

drag fill down the column.

See Excel help on the vlookup formula.
 
Thank you! I didn't know about the vlookup and hlookup commands.
It works now exactly as i wanted it!

"Tom Ogilvy" je napisal:
in C2

=if(C2<>"",Vlookup($B2,[File2.xls]Sheet1!$A$1:$F$200,3,False),"")

drag fill down the column.

See Excel help on the vlookup formula.

--
Regards,
Tom Ogilvy



Frank said:
I am having two exel files. I need a macro that looks at the number in file1
cell B2, searches that number in file2 column B and copies a number in that
row (Mx) to cell C2 in file1. It has to do that for the whole column B in
file1.

I found some simmilar tutorials, like this one:
http://cpearson.com/excel/duplicat.htm

but I can't figure out how to do exactlly what I need.

Any help would be great!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Macro Help 3
copying cells from one file to another file 4
vlookup on different sheet/tab based on stored variable 2
Comparing and Adding 7
Compare and add 1
Loop 1
Exporting & Importing with macros 2
Loop 1

Back
Top