title: Excel VBA - 1004 run-time error, Application or object-defined error
body: <p>I'm trying to go through a range of cells in a worksheet and write a formula in each one. 
  But I keep getting the error:</p>
  
  <pre><code>Run-time error '1004'
  
  Application-defined or object-defined error
  </code></pre>
  
  <p>The code looks like this right now:</p>
  
  <pre><code>Sub updateFormulasForNamedRange()
      'Application.Calculation = xlCalculationManual
      'Application.ScreenUpdating = False
  
      Dim row, col, fieldCount As Integer
      colCount = 13
      RowCount = 60
  
      For col = 1 To colCount
          For row = 1 To RowCount
              Dim strColCharacter
  
              If col &gt; 26 Then
                  strColCharacter = Chr(Int((row - 1) / 26) + 64) &amp; Chr(((row - 1) Mod 26) + 65)
              Else
                  strColCharacter = Chr(row + 64)
              End If
  
              Worksheets("Rawdata1").Cells(row, col).FormulaR1C1 = "=IF(Numbers1!$E$" &amp; col &amp; "&lt;&gt;0;Numbers1!" &amp; "$" &amp; strColCharacter &amp; "$" &amp; row &amp; ";"""")"
  
          Next row
      Next col
  
      'Application.Calculation = xlCalculationAutomatic
      'Application.ScreenUpdating = True
  End Sub
  </code></pre>
  
  <p>It fails at the line where you assign the formula to the cell. I tried to replace the string with just "test" and it works. But it's this string that's not accepted. Even though it's the exact same string that's currently in the formula bar of that exact cell.
  And the string looks fine to me?</p>
  
  <pre><code>"=IF(Numbers1!$E$1&lt;&gt;0;Numbers1!$A$1;"")"
  </code></pre>
  
  <p>I don't quite know the difference of all the Formula properties, but I've tried a variant of them and all throw the same error. So what could be causing this error?</p>