title: Using the IFERROR Function in VBA
body: <p>I recently tried to change the VBA code </p>
  
  <pre><code> Range("J2:J" &amp; Cells(Rows.Count, "A").End(xlUp).Row).FormulaR1C1 = _
                  "=INDEX(Accounts!R2C3:R491C3,MATCH(RC[-8],Accounts!R2C2:R491C2,0))"
  </code></pre>
  
  <p>to</p>
  
  <pre><code> Range("J2:J" &amp; Cells(Rows.Count, "A").End(xlUp).Row).FormulaR1C1 = _
                  "=IFERROR(INDEX(Accounts!R2C3:R491C3,MATCH(RC[-8],Accounts!R2C2:R491C2,0)),"")"
  </code></pre>
  
  <p>but received an error on the latter code.  Is there something simple I am missing?</p>
  
  <p>UPDATE:  The same error occurs with the following code:</p>
  
  <pre><code>Range("J2:J" &amp; Cells(Rows.Count, "A").End(xlUp).Row).FormulaR1C1 = _
          "=IFERROR((=INDEX(Accounts!R2C3:R" &amp; lastrow &amp; "C3,MATCH(RC[-8],Accounts!R2C2:R" &amp; lastrow &amp; "C2,0)),"""")"
  </code></pre>
  
  <p>In the above,  <code>lastrow = Cells(Rows.Count, "A").End(xlUp).Row</code></p>