Inside The Web
    Facebook Twitter Instagram
    Inside The Web
    • Office
      • Excel
      • Ms Word
      • OneDrive
      • Google Docs
      • Google Sheets
      • Google Drive
    • Email
      • Gmail
      • Outlook
      • Emal Etiquette
    • Office Etiquette
    • Productivity
    Inside The Web
    Home»Office»Excel»How to Modify Macros in Excel

    How to Modify Macros in Excel

    Nisha GurungBy Nisha GurungJuly 6, 2023 Excel 3 Mins Read

    Once you record a Macro, it captures each and every action you perform in Excel. If you have accidentally entered a different name in the cell and erased them, these commands are recorded too. Or, maybe it could be an unintended mouse click in your spreadsheet. Nonetheless, these incidents are pretty common when recording Macros at first.

    Fortunately, you can modify Macros and correct the mistakes you’ve made. This is because Excel saves all recorded Macros in the form of a VBA code. So, if you have little to basic knowledge of VBA language, you can change the code as required.

    Step 1: Unhide Personal Workbook

    If you have saved Macros in Personal Workbooks, there’s a preliminary step you should take. Since Excel hides personal workbooks by default, you would have to unhide the workbook in order to edit Macros.

    NOTE: If you do not have hidden workbook, the Unhide option will be greyed out.
    1. Open Excel File.
    2. Navigate to View Tab. From the Window group, click on Unhide.
      Navigate to View Tab. From the Window group, click on Unhide
    3. On Unhide window, select your Hidden workbook and hit OK.
      On Unhide window, select your Hidden workbook and hit OK

    Step 2: Modify Macros

    Caution: To be on the safe side, copy the VBA code and paste them onto your Notes or Docs first. This way you can avoid messing up or ruining the original Macro Code.

    To quickly bring up the Microsoft Visual Basic for Applications window, you can press Alt + F11 shortcut key. In this window, double-click on the Module you wish to edit the Macro. You should see a VBA code in the Module window. Edit the code as required.

    Example: Let us suppose we have recorded the Macro to find and highlight the lowest number from the data using Conditional Formatting. Here’s our original code. 

    But, we now wish to highlight the three numbers that are the lowest in the value. For this, we will locate the rank and change the number to 3. When done, hit the Run button or close the Window.

    Alternatively, you could also edit the codes from the Excel Ribbon. You can go to either the Macros menu or Visual Basics. 

    From Macros Menu

    1. On your workbook, go to Developer Tab.
    2. Navigate to Code section and select Macros.
      Navigate to Code section and select Macros
    3. On Macro window, select the Macro Name you want to modify. Then, click Edit.
      select the Macro Name you want to modify. Then, click Edit
    4. You should see Microsoft Visual Basic for Applications window. Double-click on the Module to modify the VBA code.
      Double-Click on the Module to modify macro
    5. Change the code as you wish. When done, close the window.

    From Visual Basics Editor

    1. From Developer Tab, click Visual Basic in the Code section.
      From Developer Tab, click Visual Basic in the Code section
    2. On Microsoft Visual Basic for Applications window, hover over the Modules menu on the left panel. Click on the Module twice.
      Click on the Module twice to edit
    3. Now, make changes in the VBA code as required. 

    After you modify the VBA code in Macro, we suggest you run the code. For this press F5 or click on the Run button. If there is even the smallest mistake in the VBA code, it can lead to different types of Run-Time Errors. 

    Why Can’t I Edit a Macro in Excel?

    You won’t be able to edit a Macro in Excel if the workbook is hidden. Or, when you’ve disabled the Macros. During such instances, Excel might as well send you the “Cannot edit a macro on a hidden workbook” error.

    To fix this, you can unhide the workbook from the View tab and enable Macros from Excel Options. For a more detailed guide, check out our other article on Cannot Edit a Macro on a Hidden Workbook article. 

    Excel Basics
    Nisha Gurung

      As a Business Student, Nisha first used Excel to outline data trends for her college projects. Later, she started exploring basic Excel functions when she realized it is a powerful tool for all businesses today. Nisha believes she can relate to many of the issues users face when starting their Excel Journey. She uses this knowledge and experience to curate contents that are fit for all types of Excel users. Apart from writing, she enjoys reading books and traveling.

      Related Posts

      Excel By Nisha Gurung

      How to Compare Two Columns in Excel Using VLOOKUP

      Excel By Nisha Gurung

      How to Share Excel Files with Multiple Users

      Excel By Nisha Gurung

      How to Filter Based on a List in Excel

      Add A Comment
      Table of ContentsToggle Table of ContentToggle
      • Step 1: Unhide Personal Workbook
      • Step 2: Modify Macros
        • From Macros Menu
        • From Visual Basics Editor
      • Why Can’t I Edit a Macro in Excel?
      • Home
      • About Us
      • Privacy Policy
      © 2025 Inside The Web

      Type above and press Enter to search. Press Esc to cancel.