Consulting

Results 1 to 5 of 5

Thread: Solved: Help with my vlookup formula

  1. #1

    Solved: Help with my vlookup formula

    I have a file that the main purpose is to search a code from the other tab and return it's value in the Search tab.

    I tried creating a Match Index and vlookup formulas but it doesn't work.

    Please help.

    Thanks!

  2. #2
    I already got the formula and the this VBA code works just fine.

    But is there a way to enhance this code to make it faster?


    Sub RF()
    Dim lRow As Long
        
        Application.Calculation = xlCalculationAutomatic
           
        lRow = Range("A:A").Find(what:="*", LookIn:=xlValues, SearchOrder:=xlByRows, _
        searchdirection:=xlPrevious).Row
        Range("B7:AW" & lRow).Formula = "=IFERROR(INDEX(CompiledData!C$2:C$65000,MATCH(1,INDEX(($A7=CompiledData!$A$2:$A$65000)*($A$3=CompiledData!$B$2:$B$65000)*(B$6=CompiledData!C$1),0),0)),0)"
        Range("B7:AW" & lRow).Copy
        Range("B7").PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
        Range("L20").Select
        
        MsgBox ("DONE")
        Application.Calculation = xlCalculationAutomatic
        
    End Sub
    Thanks in advance!

  3. #3
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Your code is calculating every cell. Change calculation to manual at the top.
    Peace of mind is found in some of the strangest places.

  4. #4
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    and...


    [vba]

    with Application
    .Calculation = xlCalculationmanual
    .screenupdating = false
    end with


    'Your code


    with Application
    .Calculation = xlCalculationautomatic
    .screenupdating = true
    end with


    [/vba]
    Cheers,

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

  5. #5
    Thanks!

Posting Permissions

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