The aim of this exercise is to prevent a run-time error message when the user cancels an input box.
Click here to download the file needed for this exercise.
- Extract and open the Movie Picker.xlsm workbook. Click the Pick Best Film button on the worksheet:
You can click the Pick Best Film or Pick Worst Film button to choose a film from the list.
- 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.
- Identify the line which caused the run-time error in the Pick_Best_Film subroutine.
Identify the offending line.
- Add an On Error statement which will cause the subroutine to exit if the user cancels the input box.
- Create a similar error handling system in the Pick_Worst_Film subroutine.
- Test that your error handling system works.
- Save and close the workbook.
Click here to download a file containing a suggested answer.