vlookup Excel 2003 vba macro different books in different folders

cometorta

New Member
Joined
Nov 4, 2009
Messages
25
Hi,

I need some help please with the following.

I want to be able to open workbook 1 and 2 and run a macro in workbook1

The Macro needs to do the following:

For all currently open workbooks except for workbook 1 the macro needs to vlookup the value A1 of Workbook 2 in a the table array A1:B1 in the not open workbook 3 which resides into a diferent folder location than workbooks 1 and 2.

How do I specify the specific location of my workbook which contains the values to be look up?

Thanks in advance,

Francisco
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
HI
Give these a try

Code:
Cells(1, 3) = "=Vlookup([workbook2.xls]Sheet1!A1,'C:\Imports\Coffee\[workbook3.xls]Sheet1'!A2:F100,3,false)"
or
Code:
Dim x as string
x = Application.WorksheetFunction.VLookup(Workbooks("Workbook2.xls").Worksheets("sheet1").Range("A1"), "C:\Imports\Coffee\" & Workbooks("workbooks3.xls").Worksheets("Sheet1").Range("A1:F100"), 3, False)
Ravi
 
Upvote 0

Forum statistics

Threads
1,216,774
Messages
6,132,651
Members
449,741
Latest member
Category5Grizzly

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top