VBA:使用&在等式中

时间:2010-08-03 20:02:22

标签: excel

我想用一个&在它内部,但VBA认为它是一个连接符号

“”&“”不起作用,还有其他技巧吗?

我的公式:

Sheets("Elasticity").Cells(iRow, 38).Formula = "=SUMIFS(" & "All_Models!$W$2:$W$" & nrow & ",All_Models!$G$2:$G$" _ & nrow & ",Elasticity!L" & iRow & ",All_Models!$AL$2:$AL$" & nrow & ",Elasticity!AK" & iRow & _ ",All_Models!$B$2:$B$" & nrow & "," & "" <= "" & "&" & "ElasticityA" & iRow & ")"

我想改造:

"" <= "" & "&" & "Elasticity!A" & iRow & ")"

成:

"<="&Elasticity!A2)

3 个答案:

答案 0 :(得分:0)

这个怎么样:

dim s as string
s = "my_complicated_formula" & "&" & "and_another_formula"

答案 1 :(得分:0)

s="foo" & Chr(38) & "bar"

其中chr(38)=&amp;

答案 2 :(得分:0)

...All_Models!$B$2:$B$" & nrow & ",""<=""&" & "Elasticity!A" & iRow & ")"