Posts by 2314samship

    I have a Vlookup in my VBA code that uses a variable for the file name. The syntax appears to be correct yet when I run the code I'm getting single quotes around the range parameters.

    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC2,'[" & sFilename2 & "]Sheet1'!B2:T5000,11,0)"

    Result is: =VLOOKUP($B2,'[US Dealer Active 2016 0531.xlsx]Sheet1'!'B2':'T5000',11,0)

    The single quotes around B2 and T5000 cause the result to be #NAME?. How do I change the code so I don't get the single quotes?