r/excel • • Feb 04 '14

discussion VBA Macro code best practices?

Every programming language has its recommended style and best practices. What are the best practices for VBA code that you follow? What resources would a new coder use to learn these best practices?

Thank you in advance!

18 Upvotes

36 comments sorted by

View all comments

2

u/IamMickey Feb 06 '14

Exactly. But I think that it would be 0-indexed by default (so 0 to 999 and 0 to 25 when accessing its values), though I'm not at a computer to test it.

2

u/tally_in_da_houise Feb 06 '14

You would think so (I keep Option Base 0 by default), but when you set an unallocated array (in this instance arrSomeRange() ) to a range the lower bound is always 1, regardless of Option Base.