How to disable the excel visual basic debug

Written by marcie thomas
  • Share
  • Tweet
  • Share
  • Email

Microsoft Excel relies on the Visual Basic language for some of its advanced features, including the use of macros. When a Visual Basic macro generates an error in Excel, it presents the user with an option to "Debug" the underlying code. If selected, this option opens the macro code in a Visual Basic editing window. You may find this undesirable, especially in situations where the current user is not the macro's creator. Disabling the Debug option and thus protecting the underlying code is possible.

Skill level:
Moderately Easy


  1. 1

    Click "Tools," "Macro" and then "Visual Basic Editor."

  2. 2

    In the Visual Basic editor window, click "Tools," then "VBAProject Properties."

  3. 3

    Click the "Protection" tab.

  4. 4

    Click to place a check next to "Lock project for viewing." Enter a password in the "Password" field, then type the password again in the "Confirm Password" field.

  5. 5

    Click "OK."

  6. 6

    Save the workbook, then close and reopen it for the changes to take effect.

Tips and warnings

  • While this method protects the code in the case of an unexpected error, it is considered good programming practice to write code specifically to handle errors.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.