Renaming Modules in VBA

zakasnak

Active Member
Joined
Sep 21, 2005
Messages
308
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
So I know HOW to rename the modules, based on the various results of my search.

What I want to know is what is the best way to rename. I feel kind of limited since the macro is named, after SUB, what I want to name it, already, but...

I've kind of figured out NOT to name it the same as what comes after SUB in the macro. I ended up with compile errors & the code required me to rename my calls to macro_name.macro_name. Wouldn't the same thing happen if I were to name the module "MacroName" while the macro itself, after SUB, was named "macro_name"? If not, then why not?

Thanks for your help!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
For modules with only one sub-routine I usually follow this convention:

Module Name:
Print_Sales_Chart

Sub Name:
PrintSalesChart

That's just the way I've been doing it but I don't think there is a "right" way, other than the fact they cannot have the same name. Coming up with a standard that is easy to follow and being consistent is more important. I'm sure others will have their own thoughts too. :biggrin:
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,558
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top