Class Error (Excel VBA)

The class Error represents a spreadsheet error for a range.

Item

To use a Error class variable it first needs to be instantiated, for example

Dim err as Error
Set err = ActiveCell.Errors(Index:=1)

Error class variables can be set using the Errors.Item procedure.

For Each

Here is an example of processing the Error items in a collection.

Dim err As Error
For Each err In ActiveCell.Errors
	
Next err

Ignore

Allows the user to set or return the state of an error checking option for a range. False enables an error checking option for a range. True disables an error checking option for a range.

Reference the ErrorCheckingOptions object to view a list of index values associated with error checking options.

ActiveCell.Errors(1).Ignore = True

Value

Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).

Dim booValue As Boolean
booValue = ActiveCell.Errors(1).Value

Errors.Item

Returns a single member of the Error object.

Item (Index)

Index: The index of the member. Can also be one the XlErrorChecks constants.

Dim errItem As Error
Set errItem = ActiveCell.Errors(Index:=1)