Data type prefixes

Many programmers create variable names by using data type prefix such as cur (for currency) and sng (for single-precision). It is good practice to use data type prefixes in your variable names, although in the examples throughout this book I have not done so because most of the macros that are written are relatively short. Adopting this approach means you must type a little extra, but your program code will become more transparent.

Use meaningful variable names when writing VBA programs. By doing this, program code will be easier to understand and easier to maintain. Many programmers use the underscore character (_) to separate distinct words or capital letters, e.g. First_Name, Age_Of_Candidate, number_of_books, and so on.

0 0

Post a comment