Assining the value of a vlookup to a cell rather than the vlookup

D

dreastman

Hi All,

I am trying to assign the value the following VBA statement to a cell
Sheets("Sheet2").Range("F1").Formula = "=VLOOKUP(" & Mid(x.Value, 20, 4) &
",Sheet2!$A$1:$C$72,3)"

It currenlty puts the formula in the cell. The only way that I have found to
work around this is to put this formula into a temporary cell and then assign
the value of it to the cell where I really want it.

How to I force the statement to evaluate the vlookup before assigning it to
the cell?

Any Help would be greatly appreciated.

~Dennis~
 
S

STEVE BELL

Sheets("Sheet2").Range("F1").Value
=WorksheetFunction.VLookUp.......................

Sheets("Sheet2").Range("F1").Value = WorksheetFunction.VLOOKUP(Mid(x.Value,
20, 4),Sheets("Sheet2").Range("$A$1:$C$72"),3)

Double check the formula to make sure it is right...
 
G

George Nicholson

Sheets("Sheet2").Range("F1") = WorksheetFunction.VLOOKUP(Mid(x.Value, 20,
4),Sheet2!$A$1:$C$72,3)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top