简体   繁体   English

单元格的公式不能用作Excel中的公式?

[英]Cell's formula not acting as a formula in excel?

I have set a cell's formula to equal a sum, yet the cell displays simply the equation, instead of the result of the equation... The value is not calculated, nor displayed. 我已经将一个单元格的公式设置为等于总和,但是该单元格仅显示方程式,而不是方程式的结果...该值既不计算也不显示。 I can copy the contents of the formula from the cell and paste it into another one and that cell will display the result, but I need the initial one to display it. 我可以从该单元格复制公式的内容,然后将其粘贴到另一个单元格中,该单元格将显示结果,但是我需要第一个显示该结果。 Here is the code: 这是代码:

Set SumRangeBegin = Cells(Sumrow, BeginSumColumn)
Set SumRangeEnd = Cells(Sumrow, EndSumColumn)
Set SumRangeTotal = Range(SumRangeBegin, SumRangeEnd)

ActiveCell.Formula = "=SUM(" & SumRangeTotal.Address & ")"

The cell will literally display =SUM($AA$854: $AV$854) (resulting from what I had set those variables to be initially... the SumRow and the SumColumn's), but won't display the result. 该单元格将实际显示= SUM($ AA $ 854:$ AV $ 854)(由于我将这些变量初始设置为... SumRow和SumColumn的结果),但不会显示结果。 Not sure why this is. 不知道为什么会这样。

试试这个-最可能的原因是该单元格设置为文本-

ActiveCell.NumberFormat = "General"

Go to the Formulas menu in the Ribbon and see if Show Formulas is checked. 转到功能区中的“公式”菜单,然后查看是否已选中“显示公式”。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM