|
Example Coding Standards for use with UserForm lessons.
Modules begin with Option Explicit
Unofficial Version Control
Modules begin with the modified date in a comment
Macros begin with a comment with version and modified date on the Sub declaration line if it is short
Macros longer than a few lines have the macro name repeated in a comment on the End Sub line
Macro names begin with a lower case letter if parameters are required
Variables declared at the top of a module reduce passed parameters
Variable names preferably begin with a lower case letter and also have a number or capital letter, to help differentiate from Excel names
Indenting
Subs, Functions, intentional code comments, and With and Loop control structures are indented 4
"_" line extensions are indented 2
Code statements temporarily commented out are not indented
Debug.Print statements; Not are
Dim shorthand (helps avoid declaration and comparison problems)
varName% same as varName As Integer
varName& same as varName As Long
varName$ same as varName As String
|
OzGrid.com accepts no responsibility for any adverse affect that may result from undertaking our training.