Issue with current VLOOKUP Code

xcelnovice101

Active Member
Joined
Aug 24, 2012
Messages
368
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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,214,533
Messages
6,120,076
Members
448,943
Latest member
sharmarick

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