Excel - Error values

Card Puncher Data Processing

Sample

List

This example inserts the seven cell error values into cells A1:A7 on Sheet1.

myArray = Array(xlErrDiv0, xlErrNA, xlErrName, xlErrNull, _ 
 xlErrNum, xlErrRef, xlErrValue) 
For i = 1 To 7 
 Worksheets("Sheet1").Cells(i, 1).Value = CVErr(myArray(i - 1)) 
Next i

If then

Worksheets("Sheet1").Activate 
If IsError(ActiveCell.Value) Then 
 errval = ActiveCell.Value 
 Select Case errval 
 Case CVErr(xlErrDiv0) 
 MsgBox "#DIV/0! error" 
 Case CVErr(xlErrNA) 
 MsgBox "#N/A error" 
 Case CVErr(xlErrName) 
 MsgBox "#NAME? error" 
 Case CVErr(xlErrNull) 
 MsgBox "#NULL! error" 
 Case CVErr(xlErrNum) 
 MsgBox "#NUM! error" 
 Case CVErr(xlErrRef) 
 MsgBox "#REF! error" 
 Case CVErr(xlErrValue) 
 MsgBox "#VALUE! error" 
 Case Else 
 MsgBox "This should never happen!!" 
 End Select 
End If

Documentation / Reference







Share this page:
Follow us:
Task Runner