• 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.

VBA Vlookup

andrea.antorini

New Member
H there,
I am struggling with some piece of VBA code in Excel.
This is the formula in my Excel Sheet:
=SE.ERRORE(CERCA.VERT(B48;'[Pianificazione 2021 dettagliata originale.xlsx]Hausammann'!$B$22:$E$70;2;FALSO);0)

Which has been translated by the (Macro recorder) in the following:
Range("C47").FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-1],'[Pianificazione 2021 dettagliata originale.xlsx]Hausammann'!R22C2:R70C5,2,FALSE),0)"
And it works fine!
Now, here comes the troubles.
In my code I have some declared variables which are myfile and mysheet
Could somebody help me and explain how could I insert these variables in the code?
myfile = Pianificazione 2021 dettagliata originale.xlsx
mysheet = Hausammann

Thanks in advance to any gurus that can solve my problem :)
Regards Andrea A.
 
Back
Top