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 reply on readable code to refresh our memories.
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.
It should remind you of its purpose (always use a descriptive name).
Variables must begin with a letter or an underscore
Variables are prefixed with an abbreviation that indicates its data type.
For example prefixing a variable with "s" indicates that it is a string.
Dim sMyString As String
For a list of all the common prefixes, please refer to the Data Types section.
Initial lowercase for variable names
Dim variableName As Object
Initial uppercase for variable names
Dim VariableName As Object
© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext