title: How to use R1C1 references in VBA?
body: <p>I'm getting 1004 error in the following code, and I'm not sure why.</p>
  
  <pre><code>Public Function SetFormulaAndPasteVals(in_range As Range, formula_str As String, start_row As Long, end_row As Long)
      Dim start_cell As Range
      Dim in_col As Long
      in_col = in_range.Column
      ' This is where I get the error
      Set start_cell = in_range.Range("R" &amp; start_row &amp; "C" &amp; in_col)
      start_cell.Formula = formula_str
      If start_row &lt; end_row Then
          start_cell.Copy Destination:=in_range.Range("R" &amp; start_row + 1 &amp; "C" &amp; in_col &amp; ":R" &amp; end_row &amp; "C" &amp; in_col)
      Else
          start_cell.Copy Destination:=in_range.Range("R" &amp; start_row - 1 &amp; in_col &amp; "C" &amp; in_col &amp; ":R" &amp; end_row &amp; "C" &amp; in_col)
      End If
      Call CopyPasteValues(in_range)
      Application.CutCopyMode = False
  End Function
  </code></pre>
  
  <p>I'm trying to avoid having to reference the column letter if it's possible.  I don't understand why it's not liking the R1C1 reference in the range function here.</p>