I have a problem with the Excel VBA Formula function. I want my VBA sub to generate the following formula in a cell:
=VLOOKUP(C5;data!J6:K611;2;TRUE)
Therefor, I used the following VBA line:
Sheets("test").Cells(1, 1).Formula = "=VLOOKUP(C5;data!J6:K611;2;TRUE)"
This results in an error: "Run-time error 1004: Application-defined or object-defined error"
If I use the following statement and afterwards manually add the "=" in front of the formula, the functions works well:
Sheets("test").Cells(1, 1).Value = "VLOOKUP(C5;data!J6:K611;2;TRUE)"
What am I doing wrong?
Formulain the immediate window. Maybe you can spot the difference then.