I can use "Evaluate" method to write the formula's result into a worksheet cell for a function like:
ActiveSheet.Range("C27") = Evaluate("MAX('Test Data'!K:K)")
which works fine and I get the value in the cell "C27"
but when I try to use it for a formula like this:
ActiveSheet.Range("C16").Value = Evaluate("AVERAGEIF('Test Data'!B:B; MIN('Test Data'!B:B); 'Test Data'!I:I)")
OR
ActiveSheet.Range("C21") = Evaluate("=SLOPE('Test Data'!I:I;'Test Data'!D:D)")
I get "#VALUE!" as the result of evaluate method in cell "C16". This is while the formula itself works fine if I use it as a worksheet formula in the cell rather than using it in VBA!
1. What am I doing wrong here?
2. Beside this problem, how should I use the evaluate method with an array function?
Any help would be appreciated!
ActiveSheet.Range("C27") = Evaluate("MAX('Test Data'!K:K)")
which works fine and I get the value in the cell "C27"
but when I try to use it for a formula like this:
ActiveSheet.Range("C16").Value = Evaluate("AVERAGEIF('Test Data'!B:B; MIN('Test Data'!B:B); 'Test Data'!I:I)")
OR
ActiveSheet.Range("C21") = Evaluate("=SLOPE('Test Data'!I:I;'Test Data'!D:D)")
I get "#VALUE!" as the result of evaluate method in cell "C16". This is while the formula itself works fine if I use it as a worksheet formula in the cell rather than using it in VBA!
1. What am I doing wrong here?
2. Beside this problem, how should I use the evaluate method with an array function?
Any help would be appreciated!