• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Making vlookup dynamic by using lastrow and lastcol

ramakriishna

New Member
How to make vlookup dynamic by using lastrow and lastcol


vba code

sub vlookup

lastrow=12

lastcol=11

activecell.formular1c1="="vlookup(RC[-1],sheet2!r1c1:R"&lastrow&"C"&lastcol,column(c[2]),false""

i want write vlookup like above while assing &lastrow and &lastcol

it is giving error

how to assign &lastrow and &lastcol to above formula

any help

Thanks in advanced
 
You can record macro while implementing the formula and then edit it to make dynamic.


That said try following [untested]:

Code:
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],Sheet2!R1C1:R" & lastrow & "C" & lastcol & ",COLUMN(RC[2]),FALSE)"
 
Back
Top