我想将一个变量值与一个RC公式相加,我尝试了以下内容:
X = "=SUM(RC[{-24 +" & variable & "}]:RC[-1])"
答案 0 :(得分:2)
使列计算独立于公式,然后将其重新连接。使用application.evaluate
同时使用xlA1和xlR1C1语法。
Dim f as string, x As double, var as integer
for var = 1 to 9
f = "=SUM(RC[" & -24 + var & "]:RC[-1])"
Debug.Print f
x = Application.Evaluate("SUM(RC[" & -24 + var & "]:RC[-1])")
Debug.Print x
next var