From the course: Excel: Learning VBA
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Manage errors using On Error statements - Microsoft Excel Tutorial
From the course: Excel: Learning VBA
Manage errors using On Error statements
- [Instructor] Even the best programmers make mistakes when they write or edit VBA code. What sets the great coders apart from the good ones is the ability to detect and fix problems in their subroutines and functions. Excel VBA provides several different tools you can use to discover and fix any errors you encounter. In this movie, I will discuss how you can manage errors by using on error statements. My sample file is 04_01_CheckError, and you can find it in the chapter four folder of the exercise files collection. And yes, this sample file does have a blank worksheet. We're going to be doing all of our work in Excel VBA. So I'll press Alt F11. And here I have my code module with a subroutine called check error. And at the top, I declared two variables, number and result. They're both longs. And below that, I have three error messages or rather error handling messages that I'll describe in a moment. The rest of the code…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Manage errors using On Error statements6m 8s
-
(Locked)
Step through a subroutine or function6m 2s
-
(Locked)
Set breakpoints in your code3m 47s
-
(Locked)
Verify output using the Immediate window5m 10s
-
(Locked)
Watch a value in a routine4m 10s
-
(Locked)
Challenge: Debug your VBA code3m 38s
-
(Locked)
Solution: Debug your VBA code4m 1s
-
(Locked)
-
-
-
-