Naming Conventions
VBA programs can quickly become quite complicated so we can use all the help we can in trying to make them as readable as possible.
Often as time passes and we move on to other projects the original ideas behind the program fade and we rely on readable code to refresh our memory.
An easy way to make programs more readable is to use a consistent naming convention throughout.
This should not only apply to variables but also to constants, procedures and all other items.
Constants
Constants - ALL CAPITALS
Variables
Variables must begin with a letter or an underscore
It should remind you of its purpose (always use a descriptive name).
Variables (local level) - Hungarian
Variables are prefixed with an abbreviation that indicates its data type.
For example prefixing a variable with "s" indicates that it is a string.
For a list of all the common prefixes, please refer to the Data Types section.
Variables (module level) - PascalCase
Initial uppercase for variable names
No data type prefix to help distinguish them
Subroutines
PascalCase
Functions
camelCase
Initial lowercase for variable names
Classes
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext