I am adding a formula into a spreadsheet via VBA that uses iferror and vlookup. Below is the code from the VBA
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("O2:o" & LastRow).FormulaR1C1 = "=IFERROR(VLOOKUP(RC1,'Controls'!a:b,2,FALSE),""Missing"")"
But when I look back into the spreadsheet, I find the following formula in the cells
=IFERROR(VLOOKUP($A2,Controls!A:(B),2,FALSE),"Missing")
which always results in a value of "Missing". When I edited the formula in the sheet and removed the parens from the B in the lookup range, the formula resolved correctly by finding the value in the Controls sheet.
I've tried changing the lookup range from A:B to A1:B500, $A$1:$B$500, and $A:$B. I also tried breaking it up and using various concatenations.
My question is ... How can I get VBA to NOT add the parens around the B in my lookup range.