VBA - VLookup

plix

Board Regular
Joined
Oct 10, 2006
Messages
187
Hi,

I get a "Subscript out of range" type error when I run this code. I assume there is something wrong with syntax (file path):

<font face=Courier New><SPAN style="color:#00007F">For</SPAN> i = Lastrow <SPAN style="color:#00007F">To</SPAN> 2 <SPAN style="color:#00007F">Step</SPAN> -1<br>    Range("D" & i).Value = Application.VLookup(Range("C" & i).Value, Worksheets("\\tom\grp-vol1\Planning\Product availabilty\[Test VLookup.xls]Sheet1").Range("A1:B99"), 2, <SPAN style="color:#00007F">False</SPAN>)<br><SPAN style="color:#00007F">Next</SPAN> i</FONT>

Also, the file from which I want to retrieve a value is on a shared folder on the network. Do I need to first open the file for the VLookup to work or not?

Hopefully someone can help.
Thanks,

Plix
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,195,591
Messages
6,010,614
Members
441,558
Latest member
lambierules

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
Top