Save Custom Functions from Excel VBA in Add-in Files
How to Find Form Controls for Excel Dashboards and Reports
Trusted Locations and Excel Macros

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


Promoted Stories From Around The Web

blog comments powered by Disqus
Where Is the Visual Basic Editor in Excel 2013?
An Excel Macro to Delete All but the Active Worksheet
Use the Check Box Control for Your Excel Dashboards
Recording Excel Macros with Relative References
An Excel Macro to Save a Workbook before Closing