How to Disable Debug in VBA in Excel
Microsoft Excel relies on the Visual Basic language for some of its advanced features, including 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. Disable the debug option to protect the underlying code in your Excel workbook macros.
Go to **File**, **Options** and then **Customize Ribbon**. In the Customize the Ribbon (Main Tabs) window pane, check the **Developer** option. Excel will now display a ribbon tab named Developer.
Return to the Excel workbook or worksheet. Click the **Developer** tab and then **Visual Basic Editor** button on the left of the main ribbon menu.
In the Visual Basic editor window, click **Tools** then **VBAProject Properties**.
Click the **Protection** tab. Click to place a check next to **Lock project for viewing**. Enter a password in the applicable field, then type the password again in the confirmation field. Click the **OK** button.
Save the workbook, then close and reopen it for the changes to take effect.