11-07-2024, 04:29 PM
Standard's for Good Code always recommend minimizing or eliminating Global variables.
That being said I find Global variables (Common or Dim Shared) to be useful especially if you want to use a value throughout your code. But keeping as many variables possible local to subs is also desired. It's almost a necessity if you want to use any kind of recursion (a sub or function calling itself).
I always say do what works. I personally recommend using Global variables sparingly (a rule I sometimes break myself). But if it works then it works.
That being said I find Global variables (Common or Dim Shared) to be useful especially if you want to use a value throughout your code. But keeping as many variables possible local to subs is also desired. It's almost a necessity if you want to use any kind of recursion (a sub or function calling itself).
I always say do what works. I personally recommend using Global variables sparingly (a rule I sometimes break myself). But if it works then it works.

