0

Currently I have the following formula working perfectly when entered directly into the excel sheet. =AVERAGEIFS(A:A,A:A,">="&10,A:A,"<="&11)

However, when I attempt to exectue it in VBA it says there is a formatting error.

Formula = Application.WorksheetFunction.AverageIfs(A:A,A:A,">="&10,A:A,"<="&11)

Is there any way to fix this?

1 Answer 1

4

You need to use Range() to define ranges in VBA:

Formula = Application.WorksheetFunction.AverageIfs(Range("A:A"), Range("A:A"), ">=10", Range("A:A"), ">=11")
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.