While using a macro, I am trying to paste the following formula into cell J2:
=IF(B2="258801",VLOOKUP(G2,Matrix!A:L,4,FALSE),IF(B2="258701",VLOOKUP(G2,Matrix!A:L,5,FALSE),IF(B2="258601",VLOOKUP(G2,Matrix!A:L,5,FALSE),IF(B2="258501",VLOOKUP(G2,Matrix!A:L,6,FALSE),IF(B2="258101",VLOOKUP(G2,Matrix!A:L,7,FALSE),IF(B2="252201",VLOOKUP(G2,Matrix!A:L,8,FALSE),IF(B2="258301",VLOOKUP(G2,Matrix!A:L,9,FALSE),"")))))))&IF(B2="258401",VLOOKUP(G2,Matrix!A:L,10,FALSE),IF(B2="258401",VLOOKUP(G2,Matrix!A:L,10,FALSE),""))
When I begin recording my macro, even if that is the only thing I do, I still get an error when I try to begin recording, select the cell, click in to edit it, paste my fomula, and then stop recording.
The error is as follows:
![]()
Sub Macro4() ' ' Macro4 Macro ' ' ActiveCell.FormulaR1C1 = _ "=IF(RC[-8]=""258801"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],4,FALSE),IF(RC[-8]=""258701"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],5,FALSE),IF(RC[-8]=""258601"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],5,FALSE),IF(RC[-8]=""258501"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],6,FALSE),IF(RC[-8]=""258101"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],7,FALSE),IF(RC[-8]=""252201"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2" & _ "E),IF(RC[-8]=""258301"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],9,FALSE),"""")))))))&IF(RC[-8]=""258401"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],10,FALSE),IF(RC[-8]=""258401"",VLOOKUP(RC[-3],Matrix!C[-9]:C[2],10,FALSE),""""))" Range("J3").Select End Sub
Can anyone help? Thank yoU!
Bookmarks