[英]Define formula of Countif in Excel VBA, not working
I really appreciate if anyone could help; 我真的很感谢有人能帮忙。 I've been working on this for a while...
我已经为此工作了一段时间...
I just want to define the formula of countif in a cell, here is the code: 我只想在一个单元格中定义countif的公式,下面是代码:
Range("E" & PLrowstart).Formula = "= CountIf($B$PLrowstart:$B$PLrowend" & ",B2)" Range(“ E”&PLrowstart).Formula =“ = CountIf($ B $ PLrowstart:$ B $ PLrowend”&“,B2)”
PLrowstart and PLrowend are integer variables I set before the line. PLrowstart和PLrowend是我在行之前设置的整数变量。 The range for count if is range("B" & PLrowstart & ":B" & PLrowend).
if的范围是range(“ B”&PLrowstart&“:B”&PLrowend)。 I've also tried other ways, none worked...
我也尝试了其他方法,但都没有效果...
TIA. TIA。
Range("E" & PLrowstart).Formula = "= CountIf($B$" & PLrowstart & ":$B$" & PLrowend & ",B2)"
Try this 尝试这个
Sub SetFormula()
PLrowstart = 2
PLrowend = 4
Range("E" & PLrowstart).Formula = "=CountIf($B$" & PLrowstart & ":$B$" & PLrowend & ",B2)"
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.