Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Still on vlookup (2000 sr 1)

    2 prob:

    prob 1)

    into column L have OI24683 i would want to lookup only the right 5 caharcter, and the code not work!
    Private Sub CommandButton1_Click()
    MATRICOLA_CTR = Right((TextBox1.Text), 5)
    DATA_CTR = Me.Textbox2.Text

    TEST = Application.WorksheetFunction.VLookup(MATRICOLA_CT R, Right(Worksheets("CODICI"), 5).Range("L2:M1500"), 2, False)

    Unload Me
    End Sub


    prob 2)
    if during the lookup the value finded not existis show msgbox"value not present, repeat insertion please".

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Still on vlookup (2000 sr 1)

    Right(Worksheets("CODICI"), 5) is not valid.

    You could add a column to the CODICI worksheet with formulas that return the last 5 characters of column L if you want to use VLookup. If the VLookup results in an error, you can display a message box (you need to create an error handler for this)

    Or you could use the Find method (you can look for "*" & MATRICOLA_CTR). If the result is Nothing, display a message box, otherwise return the cell to the right.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Still on vlookup (2000 sr 1)

    ... ACCCCC please correct only the vlooukp.
    Tks.
    Private Sub CommandButton1_Click()
    MATRICOLA_CTR = Right((TextBox1.Text), 5)
    DATA_CTR = Me.Textbox2.Text
    'TEST1 = Right(Worksheets("CODICI").Range("L2"), 5)
    TEST = Application.WorksheetFunction.VLookup(MATRICOLA_CT R, Worksheets("CODICI").Range(Worksheets("CODICI").Ri ght(Range("L2"), 5), Worksheets("CODICI").Range("M1500").End(xlUp)), 2, False)

    Unload Me
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Still on vlookup (2000 sr 1)

    Worksheets("CODICI").Right(Range("L2"), 5) is not valid either. You cannot do it this way. See my previous reply.

Posting Permissions

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