通过VBA将公式插入单元格 [英] Insert formula into a cell through VBA
本文介绍了通过VBA将公式插入单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
  无法使用此代码通过VBA将公式安装到单元格中  范围("B9")。公式=" = SUM(= LEFT(T25,SEARCH(" x",T25,1)-1))"
Cannot use this code to install a formula into a cell through VBA Range("B9").Formula = "=SUM(=LEFT(T25, SEARCH("x",T25,1)-1))"
推荐答案
Hello peterhy1,
Hello peterhy1,
根据我的测试,请尝试以下VBA代码:
Based on my test, please try the VBA code as below:
Sub test()
Range("B9").Formula = "=LEFT(T25, SEARCH(""x"",T25,1)-1)"
End Sub
请注意双引号"在公式中已加倍到""。这是必要的,因为整个公式用双引号括起来。
Note that the double quotes " within the formula have been doubled to "". This is necessary because the entire formula is enclosed in double quotes.
最好的问候,
Yuki
>
这篇关于通过VBA将公式插入单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文