ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Linest in VBA problem (https://www.excelbanter.com/excel-programming/400750-linest-vba-problem.html)

headly

Linest in VBA problem
 
Rather than write values or formulas to cells, I'm writing a function that
requires a linest and intercept using variables that store ranges for x and y
inputs. So my code looks like this
varM = WorksheetFunction.LinEst(varYVariable, varXVariable)
where varYVariable is a range like C22:C23 and varxvariable is a range like
D30:E30 (although variables declared with variant data type)
The runtime error is
1004 - Unable to get the LinEst property of the WorksheetFunction class

joel

Linest in VBA problem
 
Wneh you assign arYVariable or varXVariable it should be with a set statement

set arYVariable = Range("C22:C23
set varXVariable = Range("D30:E30")

"headly" wrote:

Rather than write values or formulas to cells, I'm writing a function that
requires a linest and intercept using variables that store ranges for x and y
inputs. So my code looks like this
varM = WorksheetFunction.LinEst(varYVariable, varXVariable)
where varYVariable is a range like C22:C23 and varxvariable is a range like
D30:E30 (although variables declared with variant data type)
The runtime error is
1004 - Unable to get the LinEst property of the WorksheetFunction class



All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com