Save Custom Functions from Excel VBA in Add-in Files
How to Add Dialog Boxes to Excel Macros with Visual Basic Editor
Top Ten Excel VBA Control Structures

How to Edit Macros in Excel's Visual Basic Editor

Click the name of the macro that you want to edit in the Macro Name list box and then click the Edit button.

This action opens the Visual Basic Editor with the code for your macro displayed in the Code window unless you select the name of a macro saved in the Personal Macro Workbook and this workbook is still hidden.

In that case, Excel displays an Alert dialog box telling you that you can’t edit a hidden macro and informing you that you need to unhide this workbook. You then need to click OK in the Alert dialog box, press Escape to close the Macro dialog box, and unhide the Personal Macro Workbook.

After you have the lines of code for the macro displayed in the Code window in the Visual Basic Editor, you can edit any of its statements as needed. If you want to obtain a printout of the lines of code in your macro before you begin making changes, choose File→Print on the Visual Basic Editor menu bar or press Ctrl+P.

This action opens a Print – VBAProject dialog box with the Current Module option button selected in the Range section and the Code check box selected in the Print What section so that you can go ahead and click OK to have Excel print all the statements in the macro.

When editing the macro’s commands, remember that you can use the Edit→Undo (Ctrl+Z) command to undo any deletion that you make by mistake.

  • Add a Comment
  • Print
  • Share

Recommends

Promoted Stories From Around The Web

blog comments powered by Disqus
Excel Macros: Shortcut Keys for Navigating the Project Window in Visual Basic Editor
Use the Option Button Control for Your Excel Dashboards
How to Assign Macros to the Ribbon and the Quick Access Toolbar in Excel 2013
Common VBA Statements for Excel VBA Programming
Excel Dashboards and Reports: How to Run Your Macros