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

    vlookup fired me... (2000 sr 1)

    In effect i want to scan all value cell by cell in column A of ISTANTANEA in AF of T3574 and recopy in INSTANTANEA the value related...Naturally if in T3574 not is fopund the corrsspondence from INSTANTANEA blank for all cells related.
    BUT ALL NOT WORK!!!!!!!!!!

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

    Re: vlookup fired me... (2000 sr 1)

    RIGA is the row number in ISTANTANEA, and TEST is the row number in T3574. You use TEST as row number in ISTANTANEA too.
    In the instruction

    Set RNG = ELENCO.Range("AF3:AF1000").End(xlDown).Find(...)

    the End(xlDown) isn't necessary; it makes Find fail.

    Sub controllo()
    Dim ELENCO As Worksheet
    Dim wsh As Worksheet
    Dim RNG As Range
    Dim TEST_CB As String
    Dim RIGA As Long
    Dim TEST As Long

    Set wsh = Worksheets("ISTANTANEA")
    Set ELENCO = Worksheets("T3574")
    RIGA = 3

    Do While Not wsh.Range("A" & RIGA) = ""
    TEST_CB = wsh.Range("A" & RIGA)
    Set RNG = ELENCO.Range("AF3:AF1000").End(xlDown).Find _
    (What:=TEST_CB, LookIn:=xlValues, LookAt:=xlWhole)
    If Not RNG Is Nothing Then
    TEST = RNG.Row
    wsh.Range("C" & RIGA) = Sheets("T3574").Range("AG" & TEST)
    wsh.Range("D" & RIGA) = Sheets("T3574").Range("AH" & TEST)
    wsh.Range("P" & RIGA) = _
    Int(wsh.Range("O" & RIGA) / Sheets("T3574").Range("AK" & TEST))
    If wsh.Range("P" & RIGA) < 3 Then
    wsh.Range("P" & RIGA).Interior.ColorIndex = 6
    End If
    End If
    RIGA = RIGA + 1
    Loop
    End Sub

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

    Re: vlookup fired me... (2000 sr 1)

    .... naturally perfect!
    Tks for

    "In the instruction

    Set RNG = ELENCO.Range("AF3:AF1000").End(xlDown).Find(...)

    the End(xlDown) isn't necessary; it makes Find fail."

    Now i have undrestand:-)

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

    Re: vlookup fired me... (2000 sr 1)

    Hi Hans, sorry for delay...
    But i think have maked an error or not have explain correctly my prob, becuase the macro find only one value.... possible????
    The match is from ISTANTANEA in T3574...

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

    Re: vlookup fired me... (2000 sr 1)

    You have put in .End(xlDown) again. I already told you that you shouldn't use that.

Posting Permissions

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