如何使文本格式的公式在另一个单元格中执行? [英] How to make formula in text format to execute in another cell?
本文介绍了如何使文本格式的公式在另一个单元格中执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我的单元格A1中包含'6*2+8*5+7*4
,并且我希望此计算在单元格A2中执行,那么每次更改单元格A1中的内容时,单元格A2的值都会相应地更改.
If I have cell A1 containing '6*2+8*5+7*4
and I want this calculation to execute in cell A2, so every time I change something in Cell A1 the value of cell A2 will change accordingly.
推荐答案
Application.Evaluate方法可以采用看起来像foirmula的字符串,并返回已解决的结果.
The Application.Evaluate method can take a string that looks like a foirmula and return a resolved result.
function eval_text(rng as range)
eval_text = application.evaluate(rng.text)
end function
在B1中,=eval_text(A1)
返回80.
这篇关于如何使文本格式的公式在另一个单元格中执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文