Reputation: 91
I'm always getting this error when inserting a formula with VBA in Excel 2013:
Run-time error '1004': Application-defined or object-defined error
This is my code:
strFormula = "=(K19 * P13) + (I19 * P13/3,2)"
strCelda = "M20"
Range(strCelda).Formula = strFormula <---- Error
I have tried with these values:
"=(K19 * P13) + (I19 * P13/3.2)"
"=(K19 * P13) + I19 * (P13/3.2)"
with no luck. Whatever the value I enter, I'm still getting the same error.
Upvotes: 1
Views: 113
Reputation: 4196
This works:
strFormula = "=(K19*P13)+(I19*P13/3.2)"
Replace comma by dot. In VBA, you always need to use the dot, regardless of your regional settings.
Upvotes: 2