Why vba doesnt handling Error 2042
- by Jonathan Raul Tapia Lopez
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 '