anglais428
Well-known Member
- Joined
- Nov 23, 2009
- Messages
- 634
- Office Version
- 2016
- Platform
- Windows
Hi,
I have the following line of code which is taken from a recorded macro and works:
ActiveCell.FormulaR1C1 = _
"=INDEX(INDIRECT(""'""&RC10&""'!""&RC11),MATCH(RC[-4],INDIRECT(""'""&RC10&""'!$A$3:$A$100""),0),MATCH(RC[1],INDIRECT(""'""&RC10&""'!$D$2:$N$2""),0))"
What I would like to do is edit the $A$3:$A$100 range to make it dynamic. The same with the $D$2:$N$2 range.
I was trying to do this using Cells(3,1) etc. so that I could then swap out the numbers (e.g. 3 and 1) with stored variables, allowing the formula to be dynamic, but I keep running into errors.
Any help would be greatly appreciated.
I have the following line of code which is taken from a recorded macro and works:
ActiveCell.FormulaR1C1 = _
"=INDEX(INDIRECT(""'""&RC10&""'!""&RC11),MATCH(RC[-4],INDIRECT(""'""&RC10&""'!$A$3:$A$100""),0),MATCH(RC[1],INDIRECT(""'""&RC10&""'!$D$2:$N$2""),0))"
What I would like to do is edit the $A$3:$A$100 range to make it dynamic. The same with the $D$2:$N$2 range.
I was trying to do this using Cells(3,1) etc. so that I could then swap out the numbers (e.g. 3 and 1) with stored variables, allowing the formula to be dynamic, but I keep running into errors.
Any help would be greatly appreciated.