0

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
4
  • 1
    Is your computer's regional system setting for List Separator a semi-colon (less common) or a comma (predominant)? Commented Jan 26, 2015 at 11:58
  • In the sheet itself, a ; suffices. However, I tried to use a , in the formula and it worked. Commented Jan 26, 2015 at 12:01
  • VBA assumes US formatting unless otherwise specified (which you could do here using FormulaR1C1Local) Commented Jan 26, 2015 at 12:04
  • @Rory - that sounds like the Answer from here. Commented Jan 26, 2015 at 12:07

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.