Vlookup from close sheet via VBA

D

Dan

Hi,
I managed to do a vlookup from a closed file via:
=VLOOKUP(A1,'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18,3,FALSE)

but I do not manage to do it by code - I think the problem is that I do not
know the sytax to put 'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18 in VBA.
Can you help, many thanks,
Dan
 
J

Joel

FormualStr = "=VLOOKUP(A1,'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18,3,FALSE)"
Range("B1).formula = FormulaStr
 
D

Dan

Thanks, but that is not what I am after- you are just assigning a formula
via code - nothing to do with vlookup.

I want to use Application.VLookup...

Thanks

Joel said:
FormualStr = "=VLOOKUP(A1,'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18,3,FALSE)"
Range("B1).formula = FormulaStr


Dan said:
Hi,
I managed to do a vlookup from a closed file via:
=VLOOKUP(A1,'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18,3,FALSE)

but I do not manage to do it by code - I think the problem is that I do not
know the sytax to put 'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18 in VBA.
Can you help, many thanks,
Dan
 
M

Mike H

Hi,

You can't do a Vlookup in VBA on a closed workbook so you have options.

1. fleeting open the workbook do the lookup and capture the value
or
2. Write a formula to the worksheet capture the value and delete the formula

Mike
 
D

Dan

Thank you

Mike H said:
Hi,

You can't do a Vlookup in VBA on a closed workbook so you have options.

1. fleeting open the workbook do the lookup and capture the value
or
2. Write a formula to the worksheet capture the value and delete the formula

Mike

Dan said:
Hi,
I managed to do a vlookup from a closed file via:
=VLOOKUP(A1,'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18,3,FALSE)

but I do not manage to do it by code - I think the problem is that I do not
know the sytax to put 'C:\temp\[test3.xls]Sheet1'!$A$1:$C$18 in VBA.
Can you help, many thanks,
Dan
 

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

Top