Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Help a Newbie with Worksheet.Application Functions in VBA? 1

Status
Not open for further replies.

DRWeig

Electrical
Apr 8, 2002
3,004
0
0
US
Hi Group,

I have a monster VBA program written, and for the first time ever I want to use a worksheet function (LinEst). I've searched the world, but I can't find the answer to "Run Time Error 424 - Object Required" that I get.

A simple example is attached. Can anyone take the time to point me in the right direction?

Best to you,

Goober Dave

Haven't see the forum policies? Do so now: Forum Policies
 
 http://files.engineering.com/getfile.aspx?folder=05e489a8-9c22-4ba7-a409-09f061d8bd92&file=ExampleWorksheetFunction.xlsm
Replies continue below

Recommended for you

The problem with your macro is that not all of the information needed for the LINEST function is provided. The LINEST function needs a range of Known Y's, Known X's, Const and Stats (the last 2 can be omitted if using the defaults). Your macro is referring to 3 ranges to begin with B - D, when LINEST is only 2 dimensional.

In order to use the LINEST function you'd need to have something like the following (at a minimum)
answer = Appplication.WorksheetFunction.LinEst("B2:B21","C2:C21")
 
Status
Not open for further replies.
Back
Top