Under those conditions it is your job to protect the user from his own actions. Fortunately, VB has the features which let you provide this level of protection. Errors When you make an error in VB, such as a divide by zero, VB responds by stopping execution of the program and will look for instructions in the code on what to do next. If you don't include those instructions, the program will simply shut down. Of course, you can use your own label name to identify where execution will begin.
Any line can have a label.
It goes at the start of the line and does not interfere with any additional code on that line. That statement will set the denominator to 1 if it was zero. Now that the denominator is changed, no error occurs and the Exit Sub procedure will execute next. When VB hits a Resume statement in the error code, it will move execution to the same line which caused the error, attempting to re-execute the line again. Be careful here, because for this to work, your error code must have fixed the problem that caused the error.