Why should I dimension my variables in VBA really?

后端 未结 2 862
时光取名叫无心
时光取名叫无心 2020-12-22 01:59

They used to say it was about memory management. However, having a look at things I find that failure to dimension a variable will default it to a variant data type which a

2条回答
  •  一生所求
    2020-12-22 02:38

    The most helpful reason I've found is it's just nice to be able to see what are variables and what are controls right away (that's more in Access than Excel), and also to just know what type of variable it's really supposed to be. This is mostly useful for other people looking through your code, as I've inherited some projects where the variables were not defined at all, and projects where they were very well defined, and the latter definitely makes things much easier. In regards to memory though, I wouldn't say it doesn't matter but the difference is negligible so it's personal choice.

提交回复
热议问题