#### .Formula Runtime error 1004 on some machines and not the other

``````ThisWorkbook.Worksheets("Dados").Cells(16, 10).FormulaLocal = "=-(I16)+" & a & "+(" & c & "*((" & PiZi & " ^ " & d & ")*(I16 ^ " & d & ")/(" & Pc & " ^ " & d & ")))"
``````

``````ThisWorkbook.Worksheets("Dados").Cells(16, 10).Formula = "=-(I16)+" & a & "+(" & c & "*((" & PiZi & " ^ " & d & ")*(I16 ^ " & d & ")/(" & Pc & " ^ " & d & ")))"
``````

PS：变量都可以并且定义明确，但问题可能是它们有小数，因此逗号或点问题

Debug.Print (With FormulaLocal) 给我：

``````=-(I16)+0,549840740436919+(0,0513418101762096*((604,958825198337 ^ 1,04086742681856)*(I16 ^ 1,04086742681856)/(49,44 ^ 1,04086742681856)))
``````
1 个回复

``````...
bloqueio = 5
On Error GoTo alternativa
ThisWorkbook.Worksheets("Dados").Cells(16, 10).Formula = "=-(I16)+" & a & "+(" & c & "*((" & PiZi & " ^ " & d & ")*(I16 ^ " & d & ")/(" & Pc & " ^ " & d & ")))"
If bloqueio = 0 Then
alternativa:
On Error GoTo -1
On Error GoTo Erro
ThisWorkbook.Worksheets("Dados").Cells(16, 10).FormulaLocal = "=-(I16)+" & a & "+(" & c & "*((" & PiZi & " ^ " & d & ")*(I16 ^ " & d & ")/(" & Pc & " ^ " & d & ")))"
End If
On Error GoTo -1
...
``````
2 运行时错误1004范围公式

3 运行时公式错误1004 swaformula

2016-04-06 20:43:39 1 76   vba
4 将公式放入单元格时出现运行时错误1004

2016-05-18 13:37:12 1 127   vba
5 替换公式时出现运行时错误1004

2018-07-05 12:50:51 1 57   vba
6 单元格（..）上的VBA运行时错误1004。公式

7 运行时错误1004复制公式数组

9 一台机器上出现运行时错误1004，而另一台机器上没有

2014-04-30 13:37:58 2 1126   vba
10 通过VBA分配单元格公式时出现运行时错误1004

2012-07-05 18:49:28 1 1299   vba/ excel