Basically in my VBA I am assigning a formula to a particular cell, and I need to declare an entire column.
So my end goal, for example, is to have this formula in cell A1:
<code>{=AVERAGE(IF(B:B="Yes",C:C))}</code>
So in my VBA I successfully used this line:
<code>[A1].FormulaArray = "=AVERAGE(IF(<b>C[1]</b>="Yes",<b>C[2]</b>))"</code>
The only problem is that I need the reference to remain as B:B and C:C regardless of what cell I put this into, instead of referencing one, and two columns over, respectively.
Normally when I use R1C1 format I would use something like RC4 (leaving the square brackets off) to result in a static column $D, with a dynamic row. So naturally, since C[1] worked referentially, I tried simply using C2 to declare a static $B:$B. This did not work, as Excel simply placed the literal C2 into my formula instead of converting it to column B.
Any suggestions?
So my end goal, for example, is to have this formula in cell A1:
<code>{=AVERAGE(IF(B:B="Yes",C:C))}</code>
So in my VBA I successfully used this line:
<code>[A1].FormulaArray = "=AVERAGE(IF(<b>C[1]</b>="Yes",<b>C[2]</b>))"</code>
The only problem is that I need the reference to remain as B:B and C:C regardless of what cell I put this into, instead of referencing one, and two columns over, respectively.
Normally when I use R1C1 format I would use something like RC4 (leaving the square brackets off) to result in a static column $D, with a dynamic row. So naturally, since C[1] worked referentially, I tried simply using C2 to declare a static $B:$B. This did not work, as Excel simply placed the literal C2 into my formula instead of converting it to column B.
Any suggestions?