


If a system does not do what it is supposed to do, then everything else about it matters little.” Bertrand Meyer Best Practices for Correct Excel VBA Code “Correctness is clearly the prime quality. This article summarises these guidelines. The format is willfully concise, but you can access detailed posts on some of these guidelines by clicking on the headings. But, they are not holy-writ, and individual developers can pick those to adopt. “Programmers spend the first 5 years of their career mastering complexity, and the rest of their lives learning simplicity.” Buzz Andersen Excel VBA Best Practices : Guidelines Or Dogma?Ĭoding best practices are consensus guidelines known to improve Excel VBA application quality. Improved lead-times on other projects (reusable code).Adding new features is easier, quicker, and cheaper.Improved procedures or macro performance and stability.There are obvious benefits to writing high-quality Excel VBA code, here are a few: “A week of coding can often save an hour of thought.” Josh Bloch Is High-Quality Excel VBA Code Worth the Effort?

Blends complementary technologies – interoperability.Is usable in different contexts or for different purposes – reusability.Eases and quickens editing or changing – flexibility.Eases reading and error finding/fixing – maintainability.Doesn’t break things in the applications it interacts with – integrity.Does more with less (time/memory) – efficiency.Runs with no ‘ unhandled‘ errors/bugs – reliability.Does what was agreed or intended (no more, no less!) – correctness.So, we can say that a high-quality Excel VBA code is one that: Testability (ease of testing) stems from software architecture rather than construction (coding).Portability (multi-platform use) depends on operating systems supporting Excel or VBA.Usability (ease of use) arises from both the application and Excel’s user interface (UI) and user experience (UX) design.Excel VBA is a hosted language (Excel being the host), so some of these attributes derive from Excel itself. Not all these attributes derive from Excel VBA code though.
