title: activecell.formulaR1C1 referring to another sheet in excel vba
body: <p>I'my trying to insert the following formula into the F column in a sheet using VBA:</p>
  
  <pre><code>=VLOOKUP($C2,userOutput.csv!$A$2:$E$162,4)
  </code></pre>
  
  <p>`user.Output.csv is another sheet in the same file.  So, I've written the following bit of VBA code:</p>
  
  <pre><code>ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3], 'userOutput.csv'!R[2]C:R[162]C[5] ,4)"
  </code></pre>
  
  <p>But, the formula's that get inserted look as follows:</p>
  
  <pre><code>cell f2 has:  =VLOOKUP(C2, userOutput.csv!F4:K164,4)
  cell f3 has:  =VLOOKUP(C3, userOutput.csv!F5:K165,4)
  cell f4 has:  =VLOOKUP(C4, userOutput.csv!F6:K166,4)
  etc...
  </code></pre>
  
  <p>how to I get the correct formula with the dollar signs I need?</p>