+ Reply to Thread
Results 1 to 18 of 18

"Cannot run the macro" error

  1. #1
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    "Cannot run the macro" error

    Hello,

    I've created a macro to run regression analysis under the data analysis option. The first time I enter my keyboard shortcut, the macro works fine. When I try re-entering the shortcut, I get the following error:

    "cannot run the macro the macro may not be available in this workbook or all macros may be disabled"

    Here is my code:

    Please Login or Register  to view this content.
    When I choose to debug the error, "application.run" to the last "false" is highlighted in yellow so this is where I assume the error is. I'm just not sure why the macro would run fine the first attempt, then fail after that.

    Any help or advice would be appreciated!

    Thanks

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Is it possible that the problem is the double commas between False and ActiveSheet.Range("$D$60") and between the last 2 False?
    Although, that may not explain the cannot run the macro error.
    Last edited by gmr4evr1; 12-31-2014 at 04:00 PM.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: "Cannot run the macro" error

    Quote Originally Posted by gmr4evr1 View Post
    Is it possible that the problem is the double commas between False and ActiveSheet.Range("$D$60") and between the last 2 False?
    Although, that may not explain the cannot run the macro error.
    Thanks for the response, but that is not causing the issue.

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Probably not the problem, but has the macro setting been changed somehow? If that's not it, is that macro stored in a file that isn't open?

  5. #5
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: "Cannot run the macro" error

    Quote Originally Posted by gmr4evr1 View Post
    Probably not the problem, but has the macro setting been changed somehow? If that's not it, is that macro stored in a file that isn't open?
    No settings have been changed and the macro is stored only in the file I'm trying to run it in.

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    What is the file extension of the file?

  7. #7
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: "Cannot run the macro" error

    Quote Originally Posted by gmr4evr1 View Post
    What is the file extension of the file?
    .xlsm is the extension

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Well shoot.

  9. #9
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Your code is calling for an .xlAm file, could this be the error?

  10. #10
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: "Cannot run the macro" error

    Quote Originally Posted by gmr4evr1 View Post
    Your code is calling for an .xlAm file, could this be the error?
    I believe XLAM is the application being run. Like I mentioned previously, the macro works the first time, then subsequently fails.

  11. #11
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Is the macro named regress or regression?

  12. #12
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: "Cannot run the macro" error

    Quote Originally Posted by gmr4evr1 View Post
    Is the macro named regress or regression?
    Regression

  13. #13
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Just taking a stab here, but, the "Application.Run" line is calling for !Regress.....should it be !Regression?

  14. #14
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: "Cannot run the macro" error

    Quote Originally Posted by gmr4evr1 View Post
    Just taking a stab here, but, the "Application.Run" line is calling for !Regress.....should it be !Regression?
    Hah, thanks I tried that too but to no avail!

  15. #15
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Well dang it! When I copied and pasted your code to one of my workbooks and changed it to !Regression, I didn't get the "cannot run the macro" error anymore. Of course I got another error, but I think that is because I don't have all the required info.
    Last edited by gmr4evr1; 12-31-2014 at 06:11 PM. Reason: Add info for it to make sense

  16. #16
    Registered User
    Join Date
    10-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: "Cannot run the macro" error

    Quote Originally Posted by gmr4evr1 View Post
    Well dang it! When I copied and pasted your code to one of my workbooks and changed it to !Regression, I didn't get the "cannot run the macro" error anymore. Of course I got another error, but I think that is because I don't have all the required info.
    Do you get the same problem where it works the first time then stops working after that?

  17. #17
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Nope, I can't run the code at all because of the new error. I get a "Run-time error '450': Wrong number of arguments or invalid property assignment" message. That is why I think I don't have all the information needed to run the code properly.

  18. #18
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: "Cannot run the macro" error

    Try separating the "Application.Run....From the , Active.Range by having the code on separate lines like the code here ...
    Please Login or Register  to view this content.
    When I ran it like this, it actually did something, but then gave me a different error, but, it did do something on the active sheet

+ 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. [SOLVED] Excel 2010 -- "Visual Basic" "Macros" and "Record Macro" all disabled.
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2017, 06:11 AM
  2. = EMBED("Forms.ComboBox.1","") error "Reference not valid."
    By CatharinaCatharina in forum Excel General
    Replies: 2
    Last Post: 12-11-2014, 09:58 AM
  3. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  4. Macro Error with code "Range("A65536").End(xlUp).EntireRow.Insert"
    By lukasj13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2010, 08:48 PM
  5. "Clean Me" Macro is giving "#VALUE!" error in the Notes field.
    By Ryan Watkins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2005, 08:05 PM

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