Consulting

Results 1 to 3 of 3

Thread: TextBox VLookUp not diplay message if EAN is wrong

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    TextBox VLookUp not diplay message if EAN is wrong

    I have EAN in tab (BD_Prod) and i have UserForm (frmCadAva), when i enter correct EAN in txtEan work well, but i clear and enter wrong EAN not displaymessage.

    I need VLookUp (inside Userform), run all time to verify correct or worng entered on textbox (txtEan).

    Private Sub txtEan_Exit(ByVal Cancel As MSForms.ReturnBoolean)If Len(txtEan.Text) >= 7 Then
        On Error Resume Next
        form1 = WorksheetFunction.VLookup(Val(txtEan.Text), Worksheets("BD_Prod").Range("A1:D100000"), 2, 0)
        form2 = WorksheetFunction.VLookup(Val(txtEan.Text), Worksheets("BD_Prod").Range("A1:D100000"), 3, 0)
        form3 = WorksheetFunction.VLookup(Val(txtEan.Text), Worksheets("BD_Prod").Range("A1:D100000"), 4, 0)
            If Err.Number = 0 Then
                txtCod.Text = form1
                txtDesc.Text = form2
                txtVlrUnit.Text = form3
            Else
                txtEan.Text = "EAN not found"
            On Error Resume Next
           End If
        On Error GoTo 0
    End If
        Me.txtEan.BackColor = RGB(255, 255, 255)
    End Sub
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •