将公式设置为一系列单元格 [英] Set formula to a range of cells
本文介绍了将公式设置为一系列单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我想要做的简单演示.我想将公式设置为一系列单元格(例如 C1 到 C10).
this is simple demo of what i want to do. I want to set a formula to a range of cells(eg. C1 to C10).
Range("C1").Formula = "=A1+B1"
但是如何让公式使用这样的动态单元格:
but how to make formula use dynamic cells like this:
Range("C1:C10").Formula = "=Ax+Bx"
实际上是这样的,
C1 = A1 + B1
C2 = A2 + B2
C3 = A3 + B3
C4 = A4 + B4
C5 = A5 + B5
...
C10 = A10 + B10
如何更改此公式的 RHS 以使上述工作正常:Range("C1:C10").Formula = "=Ax+Bx"
how to change RHS of this formula to make above working: Range("C1:C10").Formula = "=Ax+Bx"
推荐答案
我会更新 C1 中的公式.然后从C1复制公式并粘贴到C10...
I would update the formula in C1. Then copy the formula from C1 and paste it till C10...
不确定更优雅的解决方案
Not sure about a more elegant solution
Range("C1").Formula = "=A1+B1"
Range("C1").Copy
Range("C1:C10").Pastespecial(XlPasteall)
这篇关于将公式设置为一系列单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文