+ Reply to Thread
Results 1 to 2 of 2

Error when running regression using VBA?

  1. #1
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Error when running regression using VBA?

    When I am active in the workbook and run the macro with the regression it works perfectly. However, when I try to run the macro through task scheduler or a vbs script automatically, I always get the following error: run time error 1004, run method of '_Application' failed.

    I check and the Analysis Toolpak - VBA is enabled and I even have code in my macro to enable it if it's not already enabled. I also have to the Reference added as well that has to do with regression.

    This only happens when I try to trigger the macro with task scheduler or something like that. I've tried so many things that just don't seem to work. The code that errors out is below:

    Please Login or Register  to view this content.
    Is there any way to get a macro with regression to run through task scheduler without getting this run time error? Or is there another way I can do the regression without using the toolpak?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,519

    Re: Error when running regression using VBA?

    My first thought -- is there a reason for running this in VBA? The Regress utility is built on the same linear regression algorithms as the LINEST() worksheet function. Unless there is some reason for doing this in VBA, my first inclination for linear regressions is to perform the regression with the LINEST() function and not use VBA at all. https://support.office.com/en-us/art...a-fa7abf772b6d

    Even when I choose to do the regression in VBA, I will usually call the LINEST() worksheet function rather than use the regress utility. http://www.cpearson.com/excel/Callin...ionsInVBA.aspx
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Multiple Regression - Error
    By Ozwilly in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-22-2016, 09:48 AM
  2. Regression returns Linest() error
    By randomindividual in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2016, 12:20 PM
  3. Regression VBA Error
    By rheplo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-26-2015, 06:23 PM
  4. LinEst for polynomial regression in VBA - error...
    By IDidNotWantToRegiste in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2014, 11:03 PM
  5. Regression Error
    By mkeys4 in forum Excel General
    Replies: 0
    Last Post: 07-31-2013, 10:48 AM
  6. Estimating the error of a linear regression
    By METsen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-25-2012, 11:30 AM
  7. Regression - Standard Error X Variable 1
    By Claude S in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-19-2005, 06:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1