How do I use VLOOKUP in VBA instead of as a formula

Ruts

New Member
Joined
Sep 13, 2008
Messages
27
Ok I am trying to write a result into a range of cells as I think this is more efficient than writing the formula and having it recalc all the time.

The current code is below:

Code:
ActiveCell.FormulaR1C1 = _
   "=IF(ISERROR(VLOOKUP(RC[-1],C11:C12,2,FALSE)),""Not Found"",VLOOKUP(RC[-1],C11:C12,2,FALSE))"

How do I write this more efficiently so that the active cell only has the result written to it instead of the formula ?

Currently this formula is written in up to 60,000 cells - makes for a slow process time.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
try

Code:
ActiveCell = _
   EVALUATE("=IF(ISERROR(VLOOKUP(RC[-1],C11:C12,2,FALSE)),""Not Found"",VLOOKUP(RC[-1],C11:C12,2,FALSE))")

note: the values wont get refreshed automatically, when there a change in Lookup table
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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