ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering a Excel formula in a Cell through VBA? (https://www.excelbanter.com/excel-programming/302947-entering-excel-formula-cell-through-vba.html)

NooK[_20_]

Entering a Excel formula in a Cell through VBA?
 
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

--
Message posted from http://www.ExcelForum.com


BrianB

Entering a Excel formula in a Cell through VBA?
 
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

--
Message posted from http://www.ExcelForum.com


NooK[_27_]

Entering a Excel formula in a Cell through VBA?
 
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

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com