Como puedo validar un dato en un Userform que no lo encuentra VLookup?
Tengo puesto esto y no controla el error:
Private Sub TextBox2_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
ValorChequeo = Application.VLookup(Val(UserForm1.TextBox2.Value), Worksheets("Productos").Range("B6", "D179"), 3, 0)
If Err.Number = 2042 Then
MsgBox "Este producto no existe"
Cancel = True
Exit Sub
End If
End Sub
Tengo puesto esto y no controla el error:
Private Sub TextBox2_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
ValorChequeo = Application.VLookup(Val(UserForm1.TextBox2.Value), Worksheets("Productos").Range("B6", "D179"), 3, 0)
If Err.Number = 2042 Then
MsgBox "Este producto no existe"
Cancel = True
Exit Sub
End If
End Sub