Forum Discussion
Define variable in my VBA to clean my code (error)
- Sep 30, 2024
Steve_SumProductCom
Thank you very much, I did a small adjustment to your code because it was taking the col 1 and 7 of the extract.xlsx instead of the source file (see print screen below).But with the code below, it is working perfectly! Thank you. Very helpful.
.Range("B2:B" & NBrow1).FormulaR1C1 = "=INDEX(" & MDART_G2.Address(External:=True, ReferenceStyle:=xlR1C1) & ",MATCH(RC[-1]," & MDART_CODE.Address(External:=True, ReferenceStyle:=xlR1C1) & ",0))"
MDART_G2.Address(, , xlR1C1)
and
MDART_CODE.Address(, , xlR1C1)
.Range("B2:B" & NBrow1).FormulaR1C1 = "=INDEX(" & MDART_G2.Address(, , xlR1C1) & ",MATCH(RC[-1]," & MDART_CODE.Address(, , xlR1C1) & ",0))"
Steve_SumProductCom
Thank you very much, I did a small adjustment to your code because it was taking the col 1 and 7 of the extract.xlsx instead of the source file (see print screen below).
But with the code below, it is working perfectly! Thank you. Very helpful.
.Range("B2:B" & NBrow1).FormulaR1C1 = "=INDEX(" & MDART_G2.Address(External:=True, ReferenceStyle:=xlR1C1) & ",MATCH(RC[-1]," & MDART_CODE.Address(External:=True, ReferenceStyle:=xlR1C1) & ",0))"