Contrary to the StDev and other worksheet functions which you have not had a problem with in VBA, what gave rise to your question here is that you did not take into account the fact that LinEst is an array function, meaning it cannot be entered as a constant value into a cell the way you would do with non-array worksheet functions using VBA.
You can do 1 of at least 2 things:
Either produce the value in a cell by using the FormulaArray method and then PSV that cell in the next codeline of your macro if desired,
or
Just enter the value as a constant similar how you were intending to do that with the WorksheetFunction method, but in a way that VBA understands given the array nature of the issue, which involves the Evaluate command.
Even though your data is not contiguous you still need to reference the range.
If the Known X is in range C6:C17, and the known Y is in D6:D17, the array formula in a worksheet cell would be
=LINEST(D6:D17,C6:C17,1)
confirmed with Ctrl+Shift+Enter, not just with Enter.
For that example range in VBA, the codeline would be (using your cell range variable "c"):
c.Value = Evaluate("LINEST(D6:D17,C6:C17)")
Just to test that, you can set up some numbers in the aforementioned range as a test, and execute this to see the proper result:
Range("A1").Value = Evaluate("LINEST(D6:D17,C6:C17)")



Thanks:
Likes: 
Reply With Quote
Like this thread? Share it with others