Деление на ноль (ошибка 11) Division by zero (Error 11)
Деление на ноль невозможно. Division by zero isn’t possible. Эта ошибка имеет следующие причину и решение: This error has the following cause and solution:
Значение используемого в качестве делителя выражения является нолем. The value of an expression being used as a divisor is zero.
Проверьте правильность написания переменных в выражении. Check the spelling of variables in the expression. Неправильно написанное название переменной может незаметно создать числовую переменную, которая примет значение ноля. A misspelled variable name can implicitly create a numeric variable that is initialized to zero. Проверьте предыдущие операции с переменными в выражении, особенно передаваемых в процедуру в качествеаргументов из других процедур. Check previous operations on variables in the expression, especially those passed into the procedure asarguments from other procedures.
Для получения дополнительной информации выберите необходимый элемент и нажмите клавишу F1 (для Windows) или HELP (для Macintosh). For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
Поддержка и обратная связь Support and feedback
Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Have questions or feedback about Office VBA or this documentation? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь. Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Divide ByZero Exception Класс
Определение
Исключение, которое возникает при попытке деления целого значения или значения Decimal на ноль. The exception that is thrown when there is an attempt to divide an integral or Decimal value by zero.
Примеры
В следующем примере исключение обрабатывается DivideByZeroException в целочисленном делении. The following example handles a DivideByZeroException exception in integer division.
Комментарии
Попытка деления целого числа или Decimal числа на ноль вызывает DivideByZeroException исключение. Trying to divide an integer or Decimal number by zero throws a DivideByZeroException exception. Чтобы предотвратить исключение, убедитесь, что знаменатель в операции деления с целым числом или Decimal значениями не равен нулю. To prevent the exception, ensure that the denominator in a division operation with integer or Decimal values is non-zero.
Деление значения с плавающей запятой на ноль не вызывает исключение. в результате получается положительная бесконечность, отрицательная бесконечность или не число (NaN) в соответствии с правилами арифметических операций IEEE 754. Dividing a floating-point value by zero doesn’t throw an exception; it results in positive infinity, negative infinity, or not a number (NaN), according to the rules of IEEE 754 arithmetic. Поскольку в следующем примере используется деление с плавающей запятой вместо целочисленного деления, операция не создает DivideByZeroException исключение. Because the following example uses floating-point division rather than integer division, the operation does not throw a DivideByZeroException exception.
Дополнительные сведения см. в разделах Single и Double. For more information, see Single and Double.
Следующие инструкции промежуточного языка MSIL вызовут DivideByZeroException следующее: The following Microsoft intermediate language (MSIL) instructions throw DivideByZeroException:
DivideByZeroException использует COR_E_DIVIDEBYZERO HRESULT, имеющий значение 0x80020012. DivideByZeroException uses the HRESULT COR_E_DIVIDEBYZERO, which has the value 0x80020012.
Список начальных значений свойств для экземпляра DivideByZeroException, см. в разделе DivideByZeroException конструкторы. For a list of initial property values for an instance of DivideByZeroException, see the DivideByZeroException constructors.
Конструкторы
Инициализирует новый экземпляр класса DivideByZeroException. Initializes a new instance of the DivideByZeroException class.
Инициализирует новый экземпляр класса DivideByZeroException с сериализованными данными. Initializes a new instance of the DivideByZeroException class with serialized data.
Инициализирует новый экземпляр класса DivideByZeroException с указанным сообщением об ошибке. Initializes a new instance of the DivideByZeroException class with a specified error message.
Инициализирует новый экземпляр класса DivideByZeroException указанным сообщением об ошибке и ссылкой на внутреннее исключение, вызвавшее данное исключение. Initializes a new instance of the DivideByZeroException class with a specified error message and a reference to the inner exception that is the cause of this exception.
Свойства
Возвращает коллекцию пар «ключ-значение», предоставляющую дополнительные сведения об исключении. Gets a collection of key/value pairs that provide additional user-defined information about the exception.
(Унаследовано от Exception)
Получает или задает ссылку на файл справки, связанный с этим исключением. Gets or sets a link to the help file associated with this exception.
(Унаследовано от Exception)
Возвращает или задает HRESULT — кодированное числовое значение, присвоенное определенному исключению. Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.
(Унаследовано от Exception)
Возвращает экземпляр класса Exception, который вызвал текущее исключение. Gets the Exception instance that caused the current exception.
(Унаследовано от Exception)
Возвращает сообщение, описывающее текущее исключение. Gets a message that describes the current exception.
(Унаследовано от Exception)
Возвращает или задает имя приложения или объекта, вызывавшего ошибку. Gets or sets the name of the application or the object that causes the error.
(Унаследовано от Exception)
Получает строковое представление непосредственных кадров в стеке вызова. Gets a string representation of the immediate frames on the call stack.
(Унаследовано от Exception)
Возвращает метод, создавший текущее исключение. Gets the method that throws the current exception.
(Унаследовано от Exception)
Методы
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
(Унаследовано от Object)
При переопределении в производном классе возвращает исключение Exception, которое является первопричиной одного или нескольких последующих исключений. When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
(Унаследовано от Exception)
Служит хэш-функцией по умолчанию. Serves as the default hash function.
(Унаследовано от Object)
При переопределении в производном классе задает объект SerializationInfo со сведениями об исключении. When overridden in a derived class, sets the SerializationInfo with information about the exception.
(Унаследовано от Exception)
Возвращает тип среды выполнения текущего экземпляра. Gets the runtime type of the current instance.
(Унаследовано от Exception)
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Создает и возвращает строковое представление текущего исключения. Creates and returns a string representation of the current exception.
(Унаследовано от Exception)
События
Возникает, когда исключение сериализовано для создания объекта состояния исключения, содержащего сериализованные данные об исключении. Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.