Errors 属性

       

允许用户访问错误检查选项。

expression.Errors

expression   必需。该表达式返回“应用于”列表中的对象之一。

说明

引用 Errors 对象可查看与错误检查选项相关联的索引值列表。

示例

在本例中,单元格 A1 中放置了文本格式的数字。然后,Microsoft Excel 判断单元格 A1 中的数字是否为文本格式,并通知用户。

Sub CheckForErrors()

    Range("A1").Formula = "'12"

    If Range("A1").Errors.Item(xlNumberAsText).Value = True Then
        MsgBox "The number is written as text."
    Else
        MsgBox "The number is not written as text."
    End If

End Sub