Why vba doesnt handling Error 2042
Posted
by
Jonathan Raul Tapia Lopez
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan Raul Tapia Lopez
Published on 2012-12-07T10:49:20Z
Indexed on
2012/12/07
11:04 UTC
Read the original article
Hit count: 197
I have a variable "fila" with a full line with excel's values; The problem is when in excel I have --#N/A-- vba take that value like "Error 2042" and I cannot asign that value to "valor" and produce me an error, until this point everything is ok, now I am trying to define a "On error goto" for go to the "next" iteration in the loop "for", but I dont know Why vba doesnt handle the error.
Do While Not IsEmpty(ActiveCell)
txt = ActiveCell.Value2
cell = ActiveCell.Offset(0, 1).Value2
fila = Range("C20:F20")
For j = 1 To UBound(fila, 2)
On Error GoTo Siguiente
If Not IsEmpty(fila(1, j)) Then
valor = fila(1, j)
cmd = Cells(1, j + 2).Value2
devolver = function1(cmd, txt, cell, valor)
arrayDevolver(p) = devolver
p = p + 1
End If
Siguiente:
Next
Loop '
© Stack Overflow or respective owner