Save Custom Functions from Excel VBA in Add-in Files
Excel VBA Programming For Dummies Cheat Sheet
An Excel Macro to Open Workbooks to a Specific Tab

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
Macro Security and Authenticode in Excel 2013
An Excel Macro to Determine Whether a Workbook Is Open
Build Navigation Buttons with Excel Macros
A Macro to Protect Worksheets on Workbook Close
An Excel Macro to Create a Currently Dated Workbook Backup