问题描述
我以前已经问过这样的问题,但是似乎给出的答案在这种情况下不起作用
I already asked a question like this before, but seems that the answer given is not working in this case
这是我的代码:
Worksheets("Sheet").Range(myRange).formula = "=CONCATENATE(CODICI!" & stringCodiceCella & ";" & stringDesignazioneCella & ")"
请注意,stringCodiceCella是一个字符串,stringDesignazioneCella也是一个字符串.
Note that stringCodiceCella is a String, and stringDesignazioneCella is also a String.
点击此链接 VBA中公式的有效示例
我看不到错误.
推荐答案
您可以使用,"代替;"如@BigBen
You can use "," in place of ";" as suggested by @BigBen
Worksheets("Sheet").Range(myRange).Formula = "=CONCATENATE(CODICI!" & stringCodiceCella & "," & stringDesignazioneCella & ")"
或使用FormulaLocal
Worksheets("Sheet").Range(myRange).FormulaLocal = "=CONCATENATE(CODICI!" & stringCodiceCella & ";" & stringDesignazioneCella & ")"
参见下面的代码.
Worksheets("Sheet").Range(myRange).Formula = "=CONCATENATE(CODICI!" & stringCodiceCella & ",""-""," & stringDesignazioneCella & ")"
Worksheets("Sheet").Range(myRange).FormulaLocal = "=CONCATENATE(CODICI!" & stringCodiceCella & ";""-"";" & stringDesignazioneCella & ")"
这篇关于在Excel VBA中正确编写公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!