Issue with current VLOOKUP Code

xcelnovice101

Active Member
Joined
Aug 24, 2012
Messages
367
I am receiveing an "Application-defined or object-defined error" message with the following line of code.

Code:
ActiveCell.FormulaR1C1 = "=VLOOKUP('""" & LNGPORT & """','" & Folder1 & "[" & MPERFORM & "]" & SHT & "'!C2:C9,COLUMNS('" & Folder1 & "[" & MPERFORM & "]" & SHT & "'!C2:C6),0)/1000"

All of variables in the code are reading correctly, ie they're referencing the correct folder, file, and sheet name.

I also tried the following version. which yielded the same results.

Code:
ActiveCell.Formula = "=VLOOKUP('""" & LNGPORT & """','" & Folder1 & "[" & MPERFORM & "]" & SHT & "'!B7:I1000,COLUMNS('" & Folder1 & "[" & MPERFORM & "]" & SHT & "'!B7:F7),0)/1000"

I tried dropping the "Active" in the "ActiveCell.Formula" section of this code. That message was "Object required"
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,191,701
Messages
5,988,177
Members
440,135
Latest member
DCDavid

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