DEBUGGING MACROS AND CUSTOM FUNCTIONS


As you experiment with VBA, and as you create larger and more complex macros and functions, you will undoubtedly produce some code that either doesn’t run at all or doesn’t give you the result you’re looking for. Missteps of this kind are an inevitable aspect of programming, even for experts.

Fortunately, the VBA language and the Visual Basic Editor (VBE) provide tools to help you trap errors and root out bugs. Those tools are the subject of this chapter. In this chapter, you look at two kinds of error-catching tools: those that help you at design time, when you’re creating or editing code, and those that work at run time, while the code is running.

  1. Using Design-Time Tools

  2. Dealing with Run-Time Errors