Rename module vba


How to Rename or Delete a VBA module or Form

The first time you insert a module in VBA, it will certainly automatically be offered the name of “Module1” and succeeding module will certainly come to be Module2, Module3 and so on Similarly, when you insert a user create it will certainly be dubbed UserForm1, UserForm2 etc.

You watching: Rename module vba


Renaming a Module

To rename your module or create, you need to have the properties home window switched on in your VBE.

If the properties home windows is not reflecting, push F4 or go to the food selection bar and choose View, Properties Window.


Click on the module you wish to rename in the Project Explorer.Select the name residential or commercial property in the Properties Window (a module will certainly just have this property; a form has multiple properties)

3. Delete the module name (in this situation Module1) and also form in the name you desire to speak to your module.


4. Press enter to rename the module.


You rename your creates in the very same manner.

See more: Merge Message Threads Iphone, How To Merge Ios Messages Conversation Fe…

Deleting a module

Occasionally you might have actually the must rerelocate a module or develop that you no longer require.

Right-click on the module or form you wish to rerelocate to display the right click brief reduced food selection.


Click Remove (in this instance Module2)


Click on the File menu, and then click Remove (Module2).


A warning box will certainly appear asking if you desire to Export the module or form before you rerelocate it. Exporting the module or create permits you to conserve it as an individual file for usage in a different Excel project at some various other time.


More often than not when you rerelocate a module or create it is because you do not require it, so click No.

Naming Modules & Forms

It is great exercise to rename modules and also develops in order to provide them more coherent names. For instance, if UserForm1 is going to be a kind for entering invoice details, we have the right to rename it to frmInvoices. Similarly, if Module1 is going to be offered to host some basic functions that are going to be used repetitively throughout your code, you can rename it to basGeneral or modGeneral (relying on which naming conventions you prefer to use).

See more: How To Reset Password On Samsung Note 4 When Locked Out Of Note 4

It is a great concept to be regular via the naming conventions, both in naming your modules and forms, as well as the variables that you use within your code. You will alert that I have actually composed the first 3 letters of the module or develop name in lowercase, and also have actually a capital letter at the beginning of the summary for the module or create. This is well-known as CamelCase ( and also is a good halittle to get right into as soon as naming your objects. I have also provided the Leszynski naming convention which is often used by Visual Basic programmers. (