Entering a Excel formula in a Cell through VBA?

N

NooK

Geez this is the third thread today, well what do I expect I am workin
with VBA programming and Excel in a big company and being new to VBA
stumble in some problems.

Anyway this one should be simple, and I don't get why doesn't it work.

I am trying to enter a Excel formula (VLOOKUP) into a cell but all
get is "Application-Defined or Object-Defined Error".

Here is the line

Worksheets("Failures").Range("A1").Offset(1, 12).Value
"=VLOOKUP(I2;'Defect Codes'!$A$1:$B$76;2;0)"

If I substitue the formula for some random string it runs fin
otherwise I get the error, I have entered formulas before in Excel b
writing like above but I don't know why is it claiming this now.

Thanks in advance

Best Regards

Noo
 
B

BrianB

I notice that you have used semi-colons in the formula. In the UK we us
commas :-
"=VLOOKUP(I2,'Defect Codes'!$A$1:$B$76,2,0)"

It helps if you show your Location in your profile
 
N

NooK

Thanks, I have solved it by using WorkSheetFunction and running VLOOKU
from VBA instead but my location is Sweden, maybe you are right
although semi-colons do work when entered in the cells itself.

Best Regards

Noo
 
Top