Share via

Rename Module

Donnie Urbano 0 Reputation points
2026-04-23T12:21:20.83+00:00

I want to rename a module in my VB project in Excel

Developer technologies | Visual Basic for Applications
0 comments No comments

2 answers

Sort by: Most helpful
  1. Nancy Vo (WICLOUD CORPORATION) 4,190 Reputation points Microsoft External Staff Moderator
    2026-04-24T02:59:24.21+00:00

    Hello @Donnie Urbano ,

    Thanks for your question.

    To rename a module in a VB project in Excel, you can refer to some following steps:

    1. Open the Visual Basic Editor (VBE)
    • In Excel, press Alt + F11 to open the VBA editor.
    1. Locate Your Module
    • In the Project Explorer (usually on the left), find the module you want to rename.
    • It will be listed under Modules (for ex: Module1, Module2).
    1. Select the Module
    • Click once on the module name to highlight it.
    1. Change the Name in the Properties Window
    • If the Properties Window isn’t visible, press F4 to open it.
    • In the (Name) field at the top of the Properties Window, type your new module name (no spaces, must start with a letter).
    • Press Enter to confirm.

    Please note the following tips:

    • Avoid using names that conflict with VBA keywords (for ex: Sheet, Range).
    • If your macros reference the module name directly (rare), update those references after renaming.
    • The new name will appear immediately in the Project Explorer.

    I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback

    Was this answer helpful?


  2. Q&A Assist
    2026-04-23T12:21:38.5666667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To rename a VBA module in an Excel VB project and keep the code working, do the following:

    1. Open the Visual Basic Editor (VBE) from Excel with Alt+F11.
    2. In the Project Explorer window, locate the module to rename (for example, Module1).
    3. Select the module, then in the Properties window (press F4 if it is not visible), change the (Name) property to the new module name (for example, MyModule). This changes the module’s module name.
    4. If any procedures are called using the old module name for qualification, update those calls. For example, change
         Module1.MyProcedure
      
      to
         MyModule.MyProcedure
      

    If there are procedures with the same name in multiple modules or projects, always qualify calls with the correct module (and project, if needed). For example:

    Sub Main()
        Module1.MyProcedure   ' call in same project
    End Sub
    

    And across projects:

    Sub Main()
        [MyProject.vbp].[MyModule].Main
    End Sub
    

    After renaming the module, use Edit → Replace in the VBE to search for the old module name in calling statements and replace it with the new name so that Visual Basic can still find the called procedures.


    References:

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.