MS Excel Error - Cannot run the macro "***". The macros may not be available in this workbook or all macros may be disabled.

Anonymous
2018-02-01T21:13:54+00:00

I have a workbook that I am getting this error in everytime I try and click a button. I have tried creating a new button and I get the same error.

Also, I have another workbook just like this one but for the previous years data and those buttons work perfect. It is the same code and everything. What can I try? Ideas?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

14 answers

Sort by: Most helpful
  1. DaveM121 815.8K Reputation points Independent Advisor
    2018-02-01T21:18:45+00:00

    Hi asnoble, what is the exact error you are getting?

    You could try debugging the Macro:

    On the Tools menu, point to Macro, and then click Macros

    Click the macro, and then click Step Into.

    When you click Step Into, the Visual Basic Editor opens with the first line of code in the macro highlighted and with program execution halted.

    Press F8 in the Editor to execute the first line of code and step to the next

    Repeat this procedure until you find the line of code that is causing the error, then try to logically work out why it is happening . . .

    24 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2018-02-01T21:25:26+00:00

    It never makes it to the code. I tried to debug but the error just flashed up.

    See above for error. This happens on brand new buttons. I even created a button for Hello World and it never made it to the code.

    All Macros are enabled through Trust Center. And again, my other workbook works.

    Hi asnoble, what is the exact error you are getting?

    You could try debugging the Macro:

    On the Tools menu, point to Macro, and then click Macros

    Click the macro, and then click Step Into.

    When you click Step Into, the Visual Basic Editor opens with the first line of code in the macro highlighted and with program execution halted.

    Press F8 in the Editor to execute the first line of code and step to the next

    Repeat this procedure until you find the line of code that is causing the error, then try to logically work out why it is happening . . .

    23 people found this answer helpful.
    0 comments No comments
  3. DaveM121 815.8K Reputation points Independent Advisor
    2018-02-01T21:27:30+00:00

    Hi asnoble, your last post did not come through, could you please post that again . . .

    3 people found this answer helpful.
    0 comments No comments
  4. Andreas Killer 144K Reputation points Volunteer Moderator
    2018-02-02T11:18:10+00:00

    Try to recompile the complete VBA project, do as follows:

    Open the VBA editor

    Go into each module

    Insert a line (doesn't matter what you write)

    Press ENTER

    Remove the line that you've inserted

    When finished, in the menu click Debug \ Compile

    It sounds silly to do that, but it's the only way to force the compiler to rebuild any code.

    Andreas.

    17 people found this answer helpful.
    0 comments No comments
  5. Anonymous
    2018-02-02T14:31:41+00:00

    It never makes it to the code. I tried to debug but the error just flashed up.

    See above for error. This happens on brand new buttons. I even created a button for Hello World and it never made it to the code.

    All Macros are enabled through Trust Center. And again, my other workbook works.

    Hi asnoble, what is the exact error you are getting?

    You could try debugging the Macro:

    On the Tools menu, point to Macro, and then click Macros

    Click the macro, and then click Step Into.

    When you click Step Into, the Visual Basic Editor opens with the first line of code in the macro highlighted and with program execution halted.

    Press F8 in the Editor to execute the first line of code and step to the next

    Repeat this procedure until you find the line of code that is causing the error, then try to logically work out why it is happening . . .

    16 people found this answer helpful.
    0 comments No comments