Class ErrorCheckingOptions (Excel VBA)

The class ErrorCheckingOptions represents the error-checking options for an application.

Themes

Some procedures in this class have been grouped together in themes and are described on separate theme pages

Cell with its procedures EmptyCellReferences and OmittedCells
Formula with its procedures InconsistentFormula, InconsistentTableFormula and UnlockedFormulaCells

Properties

BackgroundChecking alerts the user for all cells that violate enabled error-checking rules. When this property is set to True (default), the AutoCorrect Options button appears next to all cells that violate enabled errors. False disables background checking for errors.

Sub CheckBackground() 
 
 ' Simulate an error by referring to empty cells. 
 Application.ErrorCheckingOptions.BackgroundChecking = True 
 Range("A1").Select 
 ActiveCell.Formula = "=A2/A3" 
 
End Sub

EvaluateToError when set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain formulas evaluating to an error. False disables error checking for cells that evaluate to an error value.

Sub CheckEvaluationError() 
 
 ' Simulate a divide-by-zero error. 
 Application.ErrorCheckingOptions.EvaluateToError = True 
 Range("A1").Value = 1 
 Range("A2").Value = 0 
 Range("A3").Formula = "=A1/A2" 
 
End Sub

IndicatorColorIndex returns or sets the color of the indicator for error checking options.

Sub CheckIndexColor() 
 
 If Application.ErrorCheckingOptions.IndicatorColorIndex = xlColorIndexAutomatic Then 
 MsgBox "Your indicator color for error checking is set to the default system color." 
 Else 
 MsgBox "Your indicator color for error checking is not set to the default system color." 
 End If 
 
End Sub

ListDataValidation a Boolean value that is True if data validation is enabled in a list.

MisleadingNumberFormats

NumberAsText when set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, selected cells that contain numbers written as text. False disables error checking for numbers written as text.

Sub CheckNumberAsText() 
 
 ' Simulate an error by referencing a number stored as text. 
 Application.ErrorCheckingOptions.NumberAsText = True 
 Range("A1").Value = "'1" 
 
End Sub

Parent returns the parent object for the specified object. Read-only.

TextDate when set to True (default), Microsoft Excel identifies, with an AutoCorrect Options button, cells that contain a text date with a two-digit year. False disables error checking for cells containing a text date with a two-digit year.

Sub CheckTextDate() 
 
 ' Simulate an error by referencing a text date with a two-digit year. 
 Application.ErrorCheckingOptions.TextDate = True 
 Range("A1").Formula = "'April 23, 00" 
 
End Sub