Enviado por Anónimo (no verificado) el 25 October, 2005 - 21:41.
Checate con ésto, aquí tienes la forma de Controlar varios errores, no solo el 2042 ("#N/A")
Dim Error as String
error = "Existe un error en una de las celdas, puede ser: #DIV/0, #N/A, #Name, #NULL, #Num, #ErrREF, #ErrValue, Revise por favor la Hoja de Trabajo !!!"
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
End Select
selecc = MsgBox(error, vbCritical)
If selecc = 1 Then
Exit Sub
End If
End If
Comentarios
Error
Hola,
alguien puede ayudarme con:
¿como controlo el error 2042 (#N/A) en una macro?
Error 2042
Checate con ésto, aquí tienes la forma de Controlar varios errores, no solo el 2042 ("#N/A")
Dim Error as String
error = "Existe un error en una de las celdas, puede ser: #DIV/0, #N/A, #Name, #NULL, #Num, #ErrREF, #ErrValue, Revise por favor la Hoja de Trabajo !!!"
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 End Select selecc = MsgBox(error, vbCritical) If selecc = 1 Then Exit Sub End If End IfSaludos
Luis David Chávez
ldchavez33@yahoo.com.mx