Error Handling
Exercise 7.01

Exercise 7.01

The aim of this exercise is to prevent a run-time error message when the user cancels an input box.

Files Needed

Click here to download the file needed for this exercise.


  1. Extract and open the Movie Picker.xlsm workbook.  Click the Pick Best Film button on the worksheet:
Movie picker

You can click the Pick Best Film or Pick Worst Film button to choose a film from the list.

  1. If you click Cancel on the input box which appears, you'll receive a run-time error message:

Clicking Cancel will cause a run-time error.

  1. Identify the line which caused the run-time error in the Pick_Best_Film subroutine.
Error line

Identify the offending line.

  1. Add an On Error statement which will cause the subroutine to exit if the user cancels the input box.
  2. Create a similar error handling system in the Pick_Worst_Film subroutine.
  3. Test that your error handling system works.
  4. Save and close the workbook.

Answer Files

Click here to download a file containing a suggested answer.

This page has 0 threads Add post