Consider the following statement in Excel VBA:
I = 3/2
the answer is either 1 or 1.5, depending on the data type of I (i.e. Integer or Double). If I don't declare I, it will default to Double.
However, if I do
I = 3/0
I will get a message "Runtime Error 11: Division by Zero". How should errors like these be handled? Excel VBA does not have a try-catch-finally yet, so we need to use the built-in error handling mechanism.
No comments:
Post a Comment