Lesson 20Debugging Your Code

Despite what you've always heard, there are actually three sure things in life: death, taxes, and errors in computer programs. There's no avoiding it—errors happen and they need to be fixed, whether the length of your VBA programming experience is 10 days or 10 years.

You need to learn the tools and techniques for debugging your code, so that when things go wrong you're familiar with the resources that are at your disposal for finding and fixing errors. Excel has many good built-in debugging tools. In addition, this lesson covers other techniques for avoiding errors in the first place, and, believe it or not, getting errors to work for you instead of against you.

What Is Debugging?

A bug is an error in your code that can produce erroneous results, or, depending on the nature of the bug, stop the code from executing altogether. In programming, the term debugging refers to correcting an error in code, or the process of testing a procedure for the possible existence of bugs that would need to be fixed if found.

Get Excel VBA 24-Hour Trainer, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.