ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   First Time Macro (https://www.excelbanter.com/excel-worksheet-functions/230413-first-time-macro.html)

Greensearch

First Time Macro
 
I am seeking assistance in creating a macro for the first time. I have two
Excel files (File1 and File2). Column "R" in File1 is formated as text
numbers. When I type in a value (e.g. "015") I would like a command in File1
that says, "go to File2, Column A, Row 1 to find a match. If no match go to
Row 2, Row 3 etc. until it finds a match. When it does find a match, pick up
what is in that Row/Column F File2 and put it into File1, Column "S", the
same Row I was in when I typed the "015" in Column "R".

It's basic "look-up", but I've no idea how to write it; type (e.e. 015) in
the first file, go to the second file, find a match and pick up the data in
the corresponding cell and copy it into the specified cell in first file.


Sheeloo

First Time Macro
 
Open File2... assuming lookup range is A:B in Sheet1

Enter this formula in S1 of File1
=VLOOKUP(R1,[File2.xls]Sheet1!$A:$B,2,FALSE)

If you close File2 its complete path will be added by Excel before its name.

"Greensearch" wrote:

I am seeking assistance in creating a macro for the first time. I have two
Excel files (File1 and File2). Column "R" in File1 is formated as text
numbers. When I type in a value (e.g. "015") I would like a command in File1
that says, "go to File2, Column A, Row 1 to find a match. If no match go to
Row 2, Row 3 etc. until it finds a match. When it does find a match, pick up
what is in that Row/Column F File2 and put it into File1, Column "S", the
same Row I was in when I typed the "015" in Column "R".

It's basic "look-up", but I've no idea how to write it; type (e.e. 015) in
the first file, go to the second file, find a match and pick up the data in
the corresponding cell and copy it into the specified cell in first file.



All times are GMT +1. The time now is 07:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com