Question

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:

Range("E" & PLrowstart).Formula = "= CountIf($B$PLrowstart:$B$PLrowend" & ",B2)"

PLrowstart and PLrowend are integer variables I set before the line. The range for count if is range("B" & PLrowstart & ":B" & PLrowend). I've also tried other ways, none worked...

TIA.

Was it helpful?

Solution

Range("E" & PLrowstart).Formula = "= CountIf($B$" & PLrowstart & ":$B$" & PLrowend & ",B2)"

OTHER TIPS

Try this

Sub SetFormula()


PLrowstart = 2
PLrowend = 4

Range("E" & PLrowstart).Formula = "=CountIf($B$" & PLrowstart & ":$B$" & PLrowend & ",B2)"


End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top