Excel VBA Error Handling & Debugging Flashcards
7 cards from real Excel VBA practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Excel VBA Error Handling & Debugging flashcards as text
Which statement is used to enable error handling and redirect execution to a labeled section in Excel VBA?
Answer: On Error GoTo
'On Error GoTo' is the VBA statement that redirects execution to a specified error handler label when a runtime error occurs.
What does 'On Error Resume Next' do in VBA?
Answer: Allows execution to continue with the statement following the error
'On Error Resume Next' instructs VBA to continue executing with the statement immediately following the one that caused the error.
Which built-in VBA object is used to retrieve information about the most recently occurring error?
Answer: Err
The 'Err' object contains properties like Number, Description, and Source that provide details about the last error that occurred.
What is the purpose of the Err.Clear method in VBA?
Answer: Resets the Err object's properties to their default zero/empty values
Err.Clear resets the Err object's Number, Description, and Source properties to their default values (0 and empty strings).
In VBA, what happens if a runtime error occurs inside an active error handler?
Answer: The current error handler is disabled and the error propagates to the caller
If an error occurs within an error handler, VBA disables that handler and passes the error up to the calling procedure's error handler.
Which keyword is used at the end of an error handler to return execution to the main code flow?
Answer: Resume
The 'Resume' keyword directs execution back to the main code — either re-trying the error line, moving to the next line, or jumping to a specified label.
What does 'Resume Next' do when placed inside a VBA error handler?
Answer: Continues execution with the statement after the one that caused the error
'Resume Next' directs VBA to continue execution with the statement immediately following the line that caused the error, effectively skipping it.