macro vlookup between 2 files

O

orquidea

Hi

I am using a Vloockup statement to get the information from 1 file to
another file. I have the string below, but it generates the error '1004':
Application-defined or object-defined error. I know the error is when I
added the file name [Transit Times.xls] because when I had the data for the
vloockup on sheet 1 in the same file were I was running the macro, it worked.
Could anyone help me please. FYI. In the macro I have the file Transit
Times open.

ActiveCell.Value = "=VLOOKUP(" & ActiveCell.Offset(0, -10).Address(False,
False) & "'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"

Thanks,
 
B

bpeltzer

It looks like you're missing a comma between the lookup value and the table:
ActiveCell.Value = "=VLOOKUP(" & ActiveCell.Offset(0,
-10).Address(False,False) & ",'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"
 
D

Dave Peterson

First, I'd use .formula instead of .value.

Second, it looks like you're missing a comma after the first parm.

ActiveCell.Formula _
= "=VLOOKUP(" & ActiveCell.Offset(0, -10).Address(False, False) _
& ",'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"

(added a comma before the first apostrophe)
Hi

I am using a Vloockup statement to get the information from 1 file to
another file. I have the string below, but it generates the error '1004':
Application-defined or object-defined error. I know the error is when I
added the file name [Transit Times.xls] because when I had the data for the
vloockup on sheet 1 in the same file were I was running the macro, it worked.
Could anyone help me please. FYI. In the macro I have the file Transit
Times open.

ActiveCell.Value = "=VLOOKUP(" & ActiveCell.Offset(0, -10).Address(False,
False) & "'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"

Thanks,
 
O

orquidea

Thanks it worked.

bpeltzer said:
It looks like you're missing a comma between the lookup value and the table:
ActiveCell.Value = "=VLOOKUP(" & ActiveCell.Offset(0,
-10).Address(False,False) & ",'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"




orquidea said:
Hi

I am using a Vloockup statement to get the information from 1 file to
another file. I have the string below, but it generates the error '1004':
Application-defined or object-defined error. I know the error is when I
added the file name [Transit Times.xls] because when I had the data for the
vloockup on sheet 1 in the same file were I was running the macro, it worked.
Could anyone help me please. FYI. In the macro I have the file Transit
Times open.

ActiveCell.Value = "=VLOOKUP(" & ActiveCell.Offset(0, -10).Address(False,
False) & "'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"

Thanks,
 
O

orquidea

Thanks it worked.

Dave Peterson said:
First, I'd use .formula instead of .value.

Second, it looks like you're missing a comma after the first parm.

ActiveCell.Formula _
= "=VLOOKUP(" & ActiveCell.Offset(0, -10).Address(False, False) _
& ",'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"

(added a comma before the first apostrophe)
Hi

I am using a Vloockup statement to get the information from 1 file to
another file. I have the string below, but it generates the error '1004':
Application-defined or object-defined error. I know the error is when I
added the file name [Transit Times.xls] because when I had the data for the
vloockup on sheet 1 in the same file were I was running the macro, it worked.
Could anyone help me please. FYI. In the macro I have the file Transit
Times open.

ActiveCell.Value = "=VLOOKUP(" & ActiveCell.Offset(0, -10).Address(False,
False) & "'[Transit Times.xls]Sheet1'!A:B,2,FALSE)"

Thanks,
 

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