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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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,214,570
Messages
6,120,297
Members
448,954
Latest member
EmmeEnne1979

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