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

    VLOOKUP (2000 sr 1)

    I import from another application this string.
    My problem is to make a vlookup after "D" (sheet FERIENA_FATTE) is filled from the sheet SPORTELLI and insert the relative value in "E" of the sheet


    Part of code
    ..........
    'ANAGRAFICA
    Range("A" + RIGA2) = SPORT
    Range("B" + RIGA2) = TRIM(Sess0.SCREEN.GETSTRING(4, 21, 4))
    Range("C" + RIGA2) = TRIM(Sess0.SCREEN.GETSTRING(3, 27, 30))
    Range("D" + RIGA2) = TRIM(Sess0.SCREEN.GETSTRING(4, 26, 9))
    vlookup
    ........
    the refer is in the colum B and C of SPORTELLI

    for example if D (sheet FERIENA_FATTE) contain 155002000 E (sheet FERIENA_FATTE) = CONTENZIOSO

    I make this from a formula but i need a VBA code.
    Tks

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

    Re: VLOOKUP (2000 sr 1)

    Try this:

    Range("E" & RIGA2).Formula = "=VLOOKUP(D" & RIGA2 & ",SPORTELLI!$B$1:$C$310,2,FALSE)"

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

    Re: VLOOKUP (2000 sr 1)

    ET VOILA!
    Tks.

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

    Re: VLOOKUP (2000 sr 1)

    The code work fine, but i could want to insert a string in format text in E and not a formula, is possible?

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

    Re: VLOOKUP (2000 sr 1)

    That is possible, but if someone changes the code in column D, the value in column E will not be updated, since it is not a formula. The instruction is

    Range("E" & RIGA2) = Application.WorksheetFunction.VLookup(Range("D" & RIGA2), Worksheets("SPORTELLI").Range("B1:C310"), 2, False)

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

    Re: VLOOKUP (2000 sr 1)

    ET VOILA2
    tKS.
    A bubt, but 310 is a simple range or fixed?
    I see in the sportelli an this are only 81...

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

    Re: VLOOKUP (2000 sr 1)

    I just used exactly the same range you used in the formulas in the spreadsheet you posted. If you want the range to be dynamic, replace

    Worksheets("SPORTELLI").Range("B1:C310")

    by

    Worksheets("SPORTELLI").Range(Worksheets("SPORTELL I").Range("B1"), Worksheets("SPORTELLI").Range("C65536").End(xlUp))

    or

    Worksheets("SPORTELLI").Range("B1").CurrentRegion

Posting Permissions

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