I have this statement:
.Cells(14, 22).Value = "=(" & dblSafety & "+V76*AP28)" & "/AP46"
dblSafety has double as type and the value: 10779717,8414514
It writes a Formula in a Cell. The Formula should look like this:
=(10779717,8414514 + V76 * AP28) / AP46
But i get the Error with the Number 1004. I have the german version so it says:
“Anwendungs- oder Objektdefinierter Fehler”
I think in english it would be:
“Application-defined or Object-defined error”
I dont understand why there is an error. If dblSafety is 0 then there is no error. Is the Number to big?
Any Help is appreciated
If I convert the variable to a long type I dont get any errors, but I need the decimal part.
You need to substitute explicitly the comma
, with a decimal point
. before concatenating to your formula.
Excel and VBA are not as locale-friendly as they ought to be: the implicit
CStr is causing the problem.