Excel macro formula adding quotes in formula causing vlookup to not work

前端 未结 3 1335
情深已故
情深已故 2020-12-04 04:26

I am trying to add a formula to a cell. The macro is adding quotations around the cell range, which causes the cell to return the #name error.

This is the code in th

3条回答
  •  误落风尘
    2020-12-04 04:44

    I believe the problem is caused by mixing RC notation (FormulaR1C1) and A1. Have you tried:

    Cells(1, 4).FormulaR1C1 = "=VLOOKUP(RC[-2],""Contracts!A7:D30"",3,FALSE)"
    

    ? That should work.

提交回复
热议问题