I am trying to calculate the component q'ty from Sheet Plan to Sheet Result by using Vlookup to fill in column,having:
Count_col
: is the total column in sheetPlan
Last_col
: is the total column in sheetResult
(before add column Demand)
Sheet Results
Material | Component | Demand W1 | Demand W2 |
---|---|---|---|
ABCD1000 | nc200 | #NAME? | #NAME? |
Sheet Plan
Material | Demand W1 | Demand W2 |
---|---|---|
ABCD1000 | 1000 | 200 |
For i = 1 To count_col
Cells(1, i + last_col).Value = "=Plan!RC[-2]"
Cells(1, i + last_col).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1,Plan!C1:C15,i+1,0)"
Next i
But the result is name error, I checked the spelling of function is correct and dont know how to fix. Why there is "@" in my formula?
Detail of error
=VLOOKUP($A2,Plan!$A:$O,@i+1,0)