Vlookup from row X to lastrow (not row 2)

  • Hi All,


    I'm trying to paste down a vlookup, but not across the whole data range. I have some code that has found one year prior to my data range, and then I want to apply the vlookup from there to the lastrow.


    My code so far:


    The last line is where my error happens


    I know I'm close.


    Thanks all

  • Re: Vlookup from row X to lastrow (not row 2)


    I previously had


    Code
    Set rng = Range(ActiveCell, ActiveCell.End(xlDown)) ' from the activecell to the end of the data we set our range
    
    
    
    
    rng.Formula = "=IFERROR(VLOOKUP(RC[-17],'Upload template - Settled'!C[-18],1,0), ""Not Converted"")"


    But I need the last row from another column of data, not the active cell column. Otherwise the formula won't paste down all the way as I desire.


    Hope that makes sense!

  • Re: Vlookup from row X to lastrow (not row 2)


    Must have been tired,


    I needed to use a loop


    Code
    For k = vRow To lastrow2
    
    
    sh.Range("V" & k).Formula = "=IFERROR(VLOOKUP(RC[-17],'Upload template - Settled'!C[-18],1,0), ""Not Converted"")"
    
    
    Next k

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!