Question : vlookup between workbooks - one cell

Hallo experts.
I have two workbooks.
WORKBOOK1:
name -  Budget07, saved on the desktop\BudgetFolder

WORKBOOK2:
name - SourceTable, saved on the c:\

Problem: I want to perform the following function.
1)I have a value in cell c3(in workbook1). I want to find this in workbook2.
If I find it, retun whats on the 2nd column(on workbook2). This value should be displayed in
cell E3 in workbook1.

2) If you write this in a FUNCTIOn. Please show how to call it from a macro. (I have minimal knowledge in Macros)

3) please include some comments so I may be able to modify it.

=== I have also posted the same question but this time working with ranges. Question name
"vlookup between workbooks - range of cells"

Answer : vlookup between workbooks - one cell

ofafa72,
Could you tell us how you would like to use the VLOOKUP in your VBA? Here are a few alternatives:

Dim i As Long
i=3         'Assuming that workbook SourceTable.xls is open then
Cells(i,5)=Application.Vlookup(Cells(i,3),Workbooks("SourceTable.xls").Worksheets("Sheet1").Range("A1:B10000"),2,FALSE)

If workbook SourceTable.xls is closed, then you can retrieve the value from it either using the Evaluate method, ADO, or an Excel 4 macro. This latter method may not be used in a function called by a worksheet formula, however.

John Walkenbach shows you can retrieve a value from a closed workbook at: http://www.j-walk.com/ss/excel/tips/tip82.htm
You'll need to loop through that workbook a cell at a time until you find a match for C3.

Brad
Random Solutions  
 
programming4us programming4us