ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro vlookup between 2 files (https://www.excelbanter.com/excel-discussion-misc-queries/194943-macro-vlookup-between-2-files.html)

orquidea

macro vlookup between 2 files
 
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,

bpeltzer

macro vlookup between 2 files
 
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" wrote:

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,


Dave Peterson

macro vlookup between 2 files
 
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)

orquidea wrote:

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,


--

Dave Peterson

orquidea

macro vlookup between 2 files
 
Thanks it worked.

"bpeltzer" wrote:

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" wrote:

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,


orquidea

macro vlookup between 2 files
 
Thanks it worked.

"Dave Peterson" wrote:

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)

orquidea wrote:

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,


--

Dave Peterson



All times are GMT +1. The time now is 05:54 PM.

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