Monday, September 30, 2019

Paul Kelly : Make Thy VBA More Readable Matey


  1. Use Option Explicit to force thyself to declare variables and prevent 
         total = totol + 50 ' which would run fine otherwise
  2. Declare variables just prior to using them for the first time - makes it easy, when reading the code to figure out why they enter the picture
  3. Indent your code. Even Do Knuth agrees with this one
  4. Use enumerated data type variables to eliminate magic constants - you basically give things names and, as Patrick Winston says, when you name things, you get power over them
  5. DRY! Don't repeat yourself. Use modules to keep your code manageable. Make changes in one place!

No comments: