hasdrubal
hasdrubal

Reputation: 1138

VBA Excel implement COUNTIF function

I am trying to implement a "COUNTIF()" function in my vba excel application. I know how to do this programatically but I want specifically to implement this as a formula so that later changes in the sheet will hold. This is the problematic line:

ActiveSheet.Cells(3, 20).FormulaR1C1 = "=COUNTIF(R11C7:R12C7;"">0"")"

It results in the following error:

Run-time error '1004': Application-defined or object-defined error

Upvotes: 0

Views: 244

Answers (1)

Rory
Rory

Reputation: 34035

VBA defaults to US formatting unless otherwise specified - which you could do here using FormulaR1C1Local - so you need to use a comma separator, not a semicolon.

Upvotes: 2

Related Questions