title: Run time error 1004 "Interior.Color"
body: <p>I'm programmatically creating Excel workbooks, with a macro associated to a button, this macro is supposed to check if the values entered by the user in the worksheet are correct and to color the cells in green or red depending on the case.</p>
  
  <p>The macro's code is in another Excel workbook and is added to the created workbooks with this code : </p>
  
  <pre><code> With newWorkBook.Worksheets(1).Buttons.Add(350, 115, 50, 41.25)
      .Caption = "Vérifier la conformité"
      .OnAction = "'" &amp; ThisWorkbook.FullName &amp; "'!check_FCM"
   End With
  </code></pre>
  
  <p>Here is the macro's code part that doesn't work :</p>
  
  <pre><code>For i = 0 To col - 1
      If (IsNumeric(Cells(29, i + 2).Value)) Then
          If (Cells(29, i + 2).Value &gt;= Cells(31, i + 2).Value And Cells(29, i + 2).Value &lt;= Cells(32, i + 2)) Then
              Range(Cells(29, i + 2).Address()).Interior.Color = RGB(0, 255, 0)
         Else
              Range(Cells(29, i + 2).Address()).Interior.Color = RGB(255, 0, 0)
              isCorrect = False '
          End If '
      End If '
  Next i '
  </code></pre>
  
  <p>The problem seems to be coming from the use of "<code>Interior.Color=RGB(x,y,z)</code>" because when I remove it I don't get a bug.</p>